mockito / shipkit

Toolkit for shipping it used by Mockito library
http://shipkit.org
MIT License
158 stars 35 forks source link

POM exception when using shipkit with jar archiveClassifier #847

Closed wsargent closed 4 years ago

wsargent commented 5 years ago

If you add archiveClassifier.set to the build.gradle file:

plugins {
  id "org.shipkit.java" version "2.2.5"
  id 'java'
}

//Configuring the group based on user name
//so that artifacts published from this build don't collide
//with artifacts published by other users that experiment with 'shipkit-boostrap'
group = "org.shipkit.bootstrap.${System.getProperty("user.name")}"

jar {
    archiveClassifier.set 'unbundled'
}

then you get on gradle build:

> Task :publishJavaLibraryPublicationToMavenLocal FAILED
Caching disabled for task ':publishJavaLibraryPublicationToMavenLocal' because:
  Build cache is disabled
Task ':publishJavaLibraryPublicationToMavenLocal' is not up-to-date because:
  Task has not declared any outputs despite executing actions.
:publishJavaLibraryPublicationToMavenLocal (Thread[Execution worker for ':',5,main]) completed. Took 0.002 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':publishJavaLibraryPublicationToMavenLocal'.
> Failed to publish publication 'javaLibrary' to repository 'mavenLocal'
   > Invalid publication 'javaLibrary': POM file is invalid. Check any modifications you have made to the POM file.

Project replicating the issue here:

https://github.com/wsargent/shipkit-bootstrap

magneticflux- commented 4 years ago

I experienced this as well.

Execution failed for task ':publishJavaLibraryPublicationToMavenLocal'.
> Failed to publish publication 'javaLibrary' to repository 'mavenLocal'
   > Invalid publication 'javaLibrary': POM file is invalid. Check any modifications you have made to the POM file.
Duplicated tag: 'packaging' (position: START_TAG seen ...</name>\r\n  <packaging>... @646:14) 

After clearing artifacts and adding just jar and sources, I get this new error:

Duplicated tag: 'dependencies' (position: START_TAG seen ...</ciManagement>\r\n  <dependencies>...@47:17) 
LunNova commented 4 years ago

This also happens when using a subproject's task, for example:

def gradlePluginJar = tasks.getByPath(':gradle-plugin:jar')
gradlePluginJar.getArchiveClassifier().set("gradle-plugin")
artifacts {
    add("archives", gradlePluginJar)
}