fvarrui / JavaPackager

:package: Gradle/Maven plugin to package Java applications as native Windows, MacOS, or Linux executables and create installers for them.
GNU General Public License v3.0
1.07k stars 133 forks source link

Upgrade to gradle 8 #310

Closed maths22 closed 1 year ago

maths22 commented 1 year ago

This allows local development to work with java 17.

I have tested that publishing to maven local works correctly with javas 8, 11, and 17. I have not tested publishing to maven central/staging as I do not have access to do so. I have tested publishing to a different repository with a custom repository block, and that appeared to work correctly, but I wouldn't be surprised if this needs tweaks to be happy for maven central.

fvarrui commented 1 year ago

Hi @maths22, We'll know when the next version of JavaPackager is released πŸ˜… Thanks so much!!

fvarrui commented 1 year ago

Now it seems to be a little better organized, because Gradle is not my thing.

fvarrui commented 1 year ago

Merged in branch pr-310

fvarrui commented 1 year ago

Thanks so much!!! It worked like a charm. I was able to release JP 1.7.1. to Maven Central with minor changes. Merged into devel.

fvarrui commented 1 year ago

Hi @maths22! Maybe you can throw some light, because I'm having a problem when releasing the plugin to Maven Central. My minor changes in build.gradle broken the Gradle compatibility (but fixes the next problem), so I revert those minor changes. Now, the problem is that the publish task uploads JP jar, source jar, docs and some other necessary files, but it also uploads a folder called plugin, which is detected as a bad thing when releasing .... so, I have to access to OSS Sonatype web interface, delete this folder, and finally close and release the repo manually. Do you know how we can avoid to upload this folder?

maths22 commented 1 year ago

Hmm I'll look into this.

maths22 commented 1 year ago

@fvarrui if you are able to provide a screenshot or log of the error message I think that would be helpful. Since I can't try publishing to the repo I can't directly reproduce it myself, and it doesn't seem to publish a plugin directory when i push to mavenlocal

fvarrui commented 1 year ago

As you can see here, it generates a plugin directory into my local repo (maybe needed if the plugin is released to Gradle plugin portal) ... but it's detected as a wrong artifact when releasing to Maven Central.

C:\Users\fvarrui\.m2\repository\io\github\fvarrui\javapackager>tree /f
Listado de rutas de carpetas
El nΓΊmero de serie del volumen es E4F9-DB0F
C:.
β”‚   maven-metadata-local.xml
β”‚
β”œβ”€β”€β”€1.7.2-SNAPSHOT
β”‚       javapackager-1.7.2-20230504.125631-4.jar
β”‚       javapackager-1.7.2-20230504.125631-4.jar.sha1
β”‚       javapackager-1.7.2-20230504.125631-4.pom
β”‚       javapackager-1.7.2-20230504.125631-4.pom.sha1
β”‚       javapackager-1.7.2-SNAPSHOT.jar
β”‚       javapackager-1.7.2-SNAPSHOT.pom
β”‚       m2e-lastUpdated.properties
β”‚       _remote.repositories
β”‚
β”œβ”€β”€β”€1.7.3-SNAPSHOT
β”‚       javapackager-1.7.3-SNAPSHOT-javadoc.jar
β”‚       javapackager-1.7.3-SNAPSHOT-javadoc.jar.asc
β”‚       javapackager-1.7.3-SNAPSHOT-sources.jar
β”‚       javapackager-1.7.3-SNAPSHOT-sources.jar.asc
β”‚       javapackager-1.7.3-SNAPSHOT.jar
β”‚       javapackager-1.7.3-SNAPSHOT.jar.asc
β”‚       javapackager-1.7.3-SNAPSHOT.module
β”‚       javapackager-1.7.3-SNAPSHOT.module.asc
β”‚       javapackager-1.7.3-SNAPSHOT.pom
β”‚       javapackager-1.7.3-SNAPSHOT.pom.asc
β”‚       m2e-lastUpdated.properties
β”‚       maven-metadata-local.xml
β”‚       maven-metadata-nexus.xml
β”‚       maven-metadata-nexus.xml.sha1
β”‚       resolver-status.properties
β”‚
└───plugin
    └───io.github.fvarrui.javapackager.plugin.gradle.plugin
        β”‚   maven-metadata-local.xml
        β”‚
        └───1.7.3-SNAPSHOT
                io.github.fvarrui.javapackager.plugin.gradle.plugin-1.7.3-SNAPSHOT.pom
                io.github.fvarrui.javapackager.plugin.gradle.plugin-1.7.3-SNAPSHOT.pom.asc
                maven-metadata-local.xml

But when releasing to Maven Central:

> Task :closeRepository
DEPRECATION WARNING. The staging repository ID is not provided. The fallback mode may impact release reliability and is deprecated. Please consult the project FAQ how it can be fixed.
Requested operation was executed successfully in attempt 13 (maximum allowed 21)

> Task :closeRepository FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':closeRepository'.
> Wrong 'iogithubfvarrui-1060' repository state 'open' after transition (expected [closed]). Possible staging rules violation. Check repository status using Nexus UI.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2m 6s
16 actionable tasks: 14 executed, 2 up-to-date

And this is the error message in Nexus Repository Manager:

image

image

fvarrui commented 1 year ago

And when I delete this folder (1) and manually close the repo (2), the plugin is released successfully:

image

maths22 commented 1 year ago

I filed #327 to hopefully deal with this. Thanks for the additional info-that was helpful in tracking down the POM and figuring out which part of the gradle docs to look at.