Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip testing when packaging JAR #79

Closed
typhoon2099 opened this issue Apr 3, 2018 · 6 comments
Closed

Skip testing when packaging JAR #79

typhoon2099 opened this issue Apr 3, 2018 · 6 comments

Comments

@typhoon2099
Copy link

Is this possible? I've been trying to run the mvn package command on the code from a Docker container but kept running into MongoDB issues, so I've opted to build without testing. Unfortunately I now get a "no main manifest attribute" error when I try to run the built JAR file. Do the tests have to have been successfully run for the manifest file to be generated?

@abyrd
Copy link

abyrd commented Apr 3, 2018

I don't see why adding the -DskipTests switch would skip setting the main-class attribute in the JAR. Looking at the POM I see that the main-class attribute is being set specifically on the shaded JAR. Are you running the shaded one? I'll try building it locally to see if I can reproduce the problem.

I'd also like to eliminate whatever problem you're encountering with the tests. Can you describe that in more detail or is it essentially what's reported in #78 ?

@abyrd
Copy link

abyrd commented Apr 3, 2018

The build process produces two JAR files. One is a "shaded" JAR-including-dependencies and the other contains only the code from datatools-server itself. The main-class is not set on the JAR-without-dependencies. Try running the other one (the larger one of almost 100MB).

@abyrd abyrd closed this as completed in 7325468 Apr 3, 2018
@abyrd
Copy link

abyrd commented Apr 3, 2018

I've changed the project config to set the main-class attribute on the jar without dependencies, which is preserved in the jar-with-dependencies, so both of them have the main class set now. If you run the jar without dependencies, you'd need to copy in all the dependencies and run it with all those dependencies manually added to the classpath. Maven has commands to do that (copy the dependencies or even add them automatically to the classpath) but it's a lot easier to just run the shaded JAR-with-dependencies.

@typhoon2099
Copy link
Author

I've tried the JAR with dependencies (dt-v3.2.0-dirty.jar) and it seems to be running. Once I have my Docker environment configured properly I'll be able to test it properly.

@abyrd
Copy link

abyrd commented Apr 3, 2018

OK let us know how it goes. I know next to nothing about Docker but I believe there's a Docker container configuration that you'll have to create - please feel free to contribute it via a pull request once you've got one.

@typhoon2099
Copy link
Author

Thanks for the help, I'll definitely share whatever I come up with.

Tristramg pushed a commit to etalab/transport-datatools-server that referenced this issue Apr 3, 2018
It makes it into the JAR-with-dependencies via the shade plugin (tested locally)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants