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

Migrate build to "maven-publish" plugin #284

Merged
merged 3 commits into from
Feb 29, 2020

Conversation

aaschmid
Copy link
Member

Finally got it running @codecholeric. But haven't had a look at the new "shadow" plugin and it's possibilities in order to get rid of dependencies removal in published poms, yet.

See commit message for still open points and tell me what you think about these as well as with I should get fixed.

You can check the results of a publish run at https://oss.sonatype.org/content/repositories/snapshots/com/tngtech/archunit/, version 0.13.0-SNAPSHOT or run publishToMavenLocal yourself. I also created a release (which is again dropped) and run checkUAr -PtngRepoId=1202 besides some pom formattings - at least as far as I could see manually ;-) - quite successfully IMO.
Note: Only thing was that I needed to run ./gradlew --no-parallel publish multiple times to have all artifacts in the OSS Sonatype repo but could not find out why this is the case ...

Unfortunately, the upgrade to Gradle version 5 (first commit) is required unless you want to add enableFeaturePreview('STABLE_PUBLISHING') to your settings.

@aaschmid aaschmid self-assigned this Dec 21, 2019
@ghost
Copy link

ghost commented Dec 21, 2019

Congratulations 🍻. DeepCode analyzed your code in 0.108 seconds and we found no issues. Enjoy a moment of no bugs ☀️.

💬 This comment has been generated by the DeepCode bot, installed by the owner of the repository. The DeepCode bot protects your repository by detecting and commenting on security vulnerabilities or other critical issues.


☺️ If you want to provide feedback on our bot, here is how to contact us.

@aaschmid
Copy link
Member Author

aaschmid commented Dec 21, 2019

BTW: I like the check logic for the upload quite much. Maybe I will use it for the junit-dataprovider as well some day ...

@aaschmid
Copy link
Member Author

aaschmid commented Jan 4, 2020

@codecholeric: Any feedback on this?

@codecholeric codecholeric force-pushed the migrate_build_to_maven_publish_plugin branch from a8b9948 to a9d6366 Compare February 9, 2020 22:35
@codecholeric
Copy link
Collaborator

Thanks a lot for your support! 😃

I've rebased this against master and fixed some parts. To answer the questions from your commit message:

  • I think we should keep the parallel check, because I've had many problems with broken uploads otherwise. I've improved it though, that it also detects if you run with --no-parallel
  • I removed the distributed repackagesAsm. Seemed like a good idea at the time, but in fact it will always only be archunit that repackages ASM, any other ArchUnit artifact would simply depend on that within archunit. And it only affects license handling, so I think it's fine to keep it locally within license.gradle (the way you had it)
  • I don't think we need the signing.dependsOn finishArchive, because the order seems correct anyway. publish depends on build and build on finishArchive, so I don't think we have a problem there anymore.
  • I did not completely get your last point about "refactor code to use JUnit* module mechanism"

There is one problem left (maybe you know how to fix this out of your head?): In the JUnit 5 aggregator POM the scope of the runtime dependency archunit-junit5-engine is now suddenly compile instead of runtime like before ☹️

@aaschmid
Copy link
Member Author

Thanks for the rebase and the reply.

There is one problem left (maybe you know how to fix this out of your head?): In the JUnit 5 aggregator POM the scope of the runtime dependency archunit-junit5-engine is now suddenly compile instead of runtime like before.

I think I know how to fix and will try during the next days.

@aaschmid
Copy link
Member Author

aaschmid commented Feb 16, 2020

868b6aa fixes your last issue. I (only) tested it locally by using your checkUploadedArtifacts with file:/home/user/.m2/repository/... :-)

In general, I think, we should migrate the whole project to java-library which has more features (see also https://docs.gradle.org/current/userguide/java_plugin.html) and interoperates better with maven-publish. I can do this if you want. I would also migrate the build to Gradle 6, if you agree.

@aaschmid
Copy link
Member Author

Addtional note:

I had to use --no-build-cache in order to get reproducable results. As soon as I used the build cache I got blinking "tests" (= failing/succeeding checkUploadedArtifcats tasks) with:

There exists a third party folder. Expression: (jarFile.getEntry(com/tngtech/archunit/thirdparty) == null)

I haven't looked at the root cause intensively but on a quick look it turns up that addCleanThirdPartyTask could likely cause this behavior.

@aaschmid
Copy link
Member Author

Follow up PR upgrading to Gradle 6 can be find on https://github.com/TNG/ArchUnit/tree/gradle.6

@codecholeric codecholeric force-pushed the migrate_build_to_maven_publish_plugin branch 2 times, most recently from f1d7390 to 617ea60 Compare February 29, 2020 16:52
aaschmid and others added 3 commits February 29, 2020 17:54
…ugin

* migrate project specific settings to use with new API
* move referenced sources and javadoc tasks before publishing
* classifier are no longer generated so do not need to be removed
* TNG nexus stuff is no longer used, therefore removed

Open points:
* `repackagesAsm` property is initialized too late for retrieving it in `license.gradle`
* Is check for non-parallel build on publish still required else use `./gradlew --no-parallel publish`
* Is 'signArchive dependsOn finishArchive' or something equivalent still required?
* Maybe refactor code to use JUnit* module mechanism also for archunit core

Signed-off-by: Andreas Schmid <service@aaschmid.de>
Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
Somehow uploads to Maven Central break when done in parallel, thus we should keep the check for now. Originally the idea was to keep `repackagesAsm` decentralized, i.e. every project can decide itself. In fact it will always only be `archunit` though, so I think it is easier to keep this logic within `license.gradle`.

Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
in order to publish them in correct scope automatically. To get the
`checkUploadedArtifacts` not to fail, I have to change the order of
namespaces of the expected pom.

Note:
* I also replaced tabs with spaces in `junit5/aggregator/build.gradle`.
  But only one additinal line, so no separate commit.

Signed-off-by: Andreas Schmid <service@aaschmid.de>
@codecholeric codecholeric force-pushed the migrate_build_to_maven_publish_plugin branch from 617ea60 to 90572b6 Compare February 29, 2020 16:54
@codecholeric
Copy link
Collaborator

Looks good now 😄 I've tested it a little more as well, artifacts, manifests and POMs look good and the project where I tried the aggregator POM worked fine as well.
It's well possible, that there is something shifty going on with the cleanThirdPartyTask, that was always a little hacky ☹️ Maybe once we've migrated everything to Gradle 6 and java-library we can model this in a correct way and get rid of this abomination...
Anyway, thank you so much for your support! I'll look into the Gradle 6 upgrade ASAP, then we're finally current again 😄

@codecholeric codecholeric merged commit e70742a into master Feb 29, 2020
@codecholeric codecholeric deleted the migrate_build_to_maven_publish_plugin branch February 29, 2020 17:16
@aaschmid
Copy link
Member Author

aaschmid commented Feb 29, 2020

@codecholeric: I just rebased the https://github.com/TNG/ArchUnit/tree/gradle.6 branch. I haven't had time to try to cleanup the dependencies more properly, especially test dependencies but IMO this should be done also.
The build is working on Gradle 6 branch and locally tests on the deployment also. Feel free to integrate it :-)

However, trying to further use the shadow plugin provided features was not successful yet (built poms are incorrect again; code in local stash...). And I also wanted to clean up / simplifiy the test dependencies which was not time for yet.

codecholeric added a commit that referenced this pull request Feb 21, 2021
migrate to "maven-publish" plugin

* migrate project specific settings to use with new API
* get rid of deprecated "maven" plugin
* move referenced sources and javadoc tasks before publishing
* classifier are no longer generated so do not need to be removed
* TNG nexus stuff is no longer used, therefore removed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants