Closed gavvvr closed 1 year ago
Thanks a lot! If this works it's really great. It's something that can be really useful in other projects as well where I delete test/example projects manually on each release.
But just so I understand it correctly, what does <skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
actually do? I want to upload the artifacts to maven central when I make a release. Will this not prevent it?
But just so I understand it correctly, what does
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
actually do?
Hi @johanhaleby
Setting skipNexusStagingDeployMojo
to true
for 'test-support' module prevents the module from being published to remote repository. I found this solution here.
The situation with 'example' module is different. It simply gets ignored when you specify -P release
, because whenever you specify a list of desired profiles explicitly (with -P
), all profiles which were activeByDefault
get deactivated. So, the special examples-module
profile which I created to switch on/off 'example' module gets deactivated with explicit -P release
.
To sum up, with this PR, when you build or package locally (or on CI) without specifying explicit profiles, example
module is included, because it's activeByDefault
. When you perform release with -P release
and nexus-staging-maven-plugin
, neither example
nor test-support
get published.
The reason why test-support
is not handled by custom profile like example
is: you need test-support
module, when you will build occurrent-project for publishing a release to Maven Central, but at the same time you do not want it to be published. You can't simply turn it off the same way like you can turn off 'example'. So, to prevent 'test-support' from being published, I used skipNexusStagingDeployMojo=true
The above statements were tested by publishing to local Nexus OSS. Here is the quick recipe:
docker run -d -p 8081:8081 --name nexus sonatype/nexus3
to quickly get Nexus OSS up and runningdocker exec -it nexus bash -c 'cat /nexus-data/admin.password'
to get a temp password for admin user$distributionManagement.snapshotRepository.url
in your pom.xml to be http://localhost:8081/repository/maven-snapshots/
, and comment-out gpg pluginmvn -P release clean deploy
. Yes, this command, because OSS version of Nexus does not support staging feature. You will find published components on http://localhost:8081/service/rest/repository/browse/maven-snapshots/org/occurrent/admin
to local Nexus, go to http://localhost:8081/#browse/browse:maven-snapshots:org , select the root folder and delete it with a button@gavvvr Thank you so much for this PR. It'll not only help Occurrent, but also several of my other open-source libraries. Releasing for example REST Assured, will also be much easier :)
Hi @johanhaleby This should fix #138
I hope
skipNexusStagingDeployMojo
will work out (I do not know how to test it for sure) The reason why I usedskipNexusStagingDeployMojo
for 'test-support' instead of just excluding it like 'examples' is because I think 'test-support' is needed when you publish (because you need to verify/execute tests)