Cannot run maven provided elasticmq-server JAR standalone?

67 views
Skip to first unread message

Marcus Little

unread,
Mar 5, 2020, 11:55:19 AM3/5/20
to ElasticMQ
I am working on running ElasticMQ as part of some automated acceptance tests for some SQS code that has not previously had test coverage. 

I wanted to download the jar using maven and I would like to run the ElastcMQ server jar in standalone mode.

This works fine using the link provided on the readme: https://s3-eu-west-1.amazonaws.com/softwaremill-public/elasticmq-server-0.15.4.jar.

However, this does not work when I try to run the maven provided elasticmq-server JAR:
```
java -jar elasticmq-server_2.13-0.15.4.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/elasticmq/util/Logging
```

Looking at the JAR, using `jar -tvf`, I can see the difference between the 'standalone' linked JAR from the readme page and the maven provided one.

Is it possible to provide the uberjar as an artifact in maven?
Is there another approach I should be using to acquire the standalone JAR as part of the build process?

Thanks for your help -

Adam Warski

unread,
Mar 5, 2020, 12:03:20 PM3/5/20
to ElasticMQ
You are right, the uploaded version is the uberjar, and in maven you have individual dependencies. Publishing uberjars to maven is generally considered an “antipattern”, so I’d like to avoid that.

Maybe you can just add the maven artifact to your  pom.xml so that all of the dependencies are properly downloaded?

Adam

Marcus Little

unread,
Mar 5, 2020, 12:07:58 PM3/5/20
to ElasticMQ
I wondered if that was against Maven conventions for size reasons? 

I was just thinking the same thing Adam and I'll pursue that approach.

Otherwise the documentation has been excellent and I was quickly able to get test coverage on some SQS code that we haven't exercised as part of the build in a long time. This will be very helpful - thanks!

Adam Warski

unread,
Mar 5, 2020, 12:10:46 PM3/5/20
to ElasticMQ
Probably this as well, but it also side-steps the whole dependency management that is part of maven, and can cause duplicates on the classpath if the uberjar and another dependency contain the same class (which is not detected because of the lacking dependency metadata)

Adam

Adam Warski

unread,
Mar 5, 2020, 12:15:32 PM3/5/20
to ElasticMQ
And thank you very much for the kind words :)

Marcus Little

unread,
Mar 6, 2020, 11:42:44 PM3/6/20
to ElasticMQ
Just to follow up on here in case anyone google's this in future.

Before: I had a process in my acceptance test which used the uberjar.
Now: I used the provided maven artifact (elasticmq-rest-sqs_2.13) to start/stop Elastic MQ programatically.

The documentation listed this embedded mode, but I had just dived into prototyping with the uberjar and kind of missed the other approach.

If I was to perhaps make one documentation suggestion? A 1 sentence overview of each maven artifact (and what its usage is) might be helpful?

Thanks again for the help -

Adam Warski

unread,
Mar 7, 2020, 3:07:04 AM3/7/20
to ElasticMQ
Documentation suggestions are always welcome :) Maybe you could create a PR with a template on how this could look like? If you're not sure about some artifact, I'll be happy to fill in the blanks.

Adam

W dniu czwartek, 5 marca 2020 17:55:19 UTC+1 użytkownik Marcus Little napisał:
Reply all
Reply to author
Forward
0 new messages