Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle publishing to Maven adds a suffix that does not seem to work from Maven POM dependencies

When I publish to a local maven repository from a Gradle project, I find that the main JAR file has a -plain suffix.

pdffer/pdffer-template/1.0-SNAPSHOT 
➜ ll
total 32
-rw-r--r--  1 fedmest  staff   918B Sep  1 16:39 maven-metadata-local.xml
-rw-r--r--  1 fedmest  staff   3.8K Sep  1 16:39 pdffer-template-1.0-SNAPSHOT-plain.jar
-rw-r--r--  1 fedmest  staff   1.9K Sep  1 16:39 pdffer-template-1.0-SNAPSHOT.module
-rw-r--r--  1 fedmest  staff   1.7K Sep  1 16:39 pdffer-template-1.0-SNAPSHOT.pom

When I include this library as a Maven dependency from a POM file, it cannot find it - it only works if I rename the main JAR to exclude the -plain suffix. Can I get Gradle to generate the JAR without the suffix? Any idea why the suffix appears, please?

like image 967
fedmest Avatar asked Oct 27 '25 10:10

fedmest


1 Answers

To disable 'plain', follow the springboot documentation: https://docs.spring.io/spring-boot/docs/current/gradle-plugin/reference/htmlsingle/#packaging-executable.and-plain-archives

jar {
    classifier = ''
}

I also found the answer here: https://stackoverflow.com/a/67752182/11723872

like image 125
orid Avatar answered Oct 30 '25 10:10

orid



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!