Compiling Graylog-server code for plugin development

I am interested in building my Graylog plugin without having to compile the whole graylog-server project (I am getting yarn build error).
I prefer to compile the plugin only and deploy to production. Is there a possibility of running mvn package for the plugin like before?

The only difference to before is that instead of using an example plugin code, I bootstrapped from github.

Hello @ofentselogger

Are you refering to this in GitHub?

Hi @gsmith

Yes, that is what I refer to. I used it to checkout version 4.2 and I then followed the below to bootstrap my plugin before I then ran mvn compile & mvn package for the whole project. I followed the 4-x version which seems similar.

Either I just picked up an Out of Memory issue with my server. I need to add some RAM so I can get the compilation to terminate successfully. I will post an update as soon as I complete this.

https://go2docs.graylog.org/5-0/what_more_can_graylog_do_for_me/plugins.html

Wow, I somewhat underestimated the size of the compile. Finally I have something meaningful after resolving the memory issue.
I have managed to do the initial mvn compile. I manage to compile everything but my plugin. It talks of an issue with the target version. Not sure if this relates to Java 17? But I run Graylog 4.2 on openjdk 1.8 *. Below are the error logs.

Blockquote
[INFO] — maven-compiler-plugin:3.7.0:compile (default-compile) @ graylog-plugin-smpp —
[INFO] Compiling 4 source files to /home/graylog/build/graylog-project-repos/graylog-plugin-smpp/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Graylog Parent POM … SUCCESS [ 0.034 s]
[INFO] Graylog Project Parent POM … SUCCESS [ 0.127 s]
[INFO] Graylog … SUCCESS [08:41 min]
[INFO] Graylog Plugin Parent POM … SUCCESS [ 0.004 s]
[INFO] Graylog Plugin with Web support Parent POM … SUCCESS [ 3.497 s]
[INFO] graylog-plugin-collector … SUCCESS [05:15 min]
[INFO] graylog-plugin-aws … SUCCESS [04:38 min]
[INFO] graylog-plugin-threatintel … SUCCESS [05:20 min]
[INFO] graylog-plugin-integrations … SUCCESS [05:07 min]
[INFO] graylog-project 4.2.14-SNAPSHOT … SUCCESS [ 0.015 s]
[INFO] runner … SUCCESS [ 0.523 s]
[INFO] graylog-storage-elasticsearch6 … SUCCESS [ 4.230 s]
[INFO] graylog-storage-elasticsearch7 … SUCCESS [ 3.838 s]
[INFO] full-backend-tests … SUCCESS [ 0.651 s]
[INFO] graylog-plugin-archetype … SUCCESS [ 0.161 s]
[INFO] Graylog Binary Distribution Tarball … SUCCESS [ 0.048 s]
[INFO] graylog-plugin-smpp 1.0.0-SNAPSHOT … FAILURE [02:44 min]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 32:01 min
[INFO] Finished at: 2022-12-16T17:30:43Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project graylog-plugin-smpp: Fatal error compiling: CompilerException: InvocationTargetException: invalid target release: 17 → [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.

Blockquote

The plugin was bootstrapped for Java 17. I modified the pom to 1.8. I now have a successful compile.

Hey.,

Nice, can I ask what or how much resources do you have on that node? if the issues is resolved could you mark this as " resolved " for future searches.

Hi @gsmith
Resources: I had about 2GB RAM with 2 vCPUs and a minimum of 25GB HDD. This was not sufficient. I also remembered that when I was building glibc earlier this year, I needed more than 2GB RAM.
So to be safe I increased the RAM to 8GB.

I have now marked the issue as resolved. I am now left with basic programmatic issues (I copied and pasted an old plugin code to this new bootstrap) in order to make this new bootstrap work. It seems older plugin code doesnt run on Graylog 4.2.x hence I had to bootstrap (and made mistakes to learn from :))

Thanks.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.