rholder / gradle-one-jar

The gradle-one-jar project is a Gradle plugin that uses One-JAR, a specialised Class-Loader written by Simon Tuffs (http://one-jar.sourceforge.net/), for building self-contained executable jars that include all dependencies.
Apache License 2.0
217 stars 41 forks source link

one-jar artifact is already added by the plugin #3

Closed rafaroca closed 11 years ago

rafaroca commented 11 years ago

We had an issue trying to upload our fat jar to a maven repository. The task always failed with the error

   Could not publish configuration 'archives'
     A POM cannot have multiple artifacts with the same type and classifier. 
         Already have MavenArtifact myservice:jar:jar:fat, trying to add MavenArtifact myservice:jar:jar:fat.

We figured out, that the gradle-one-jar-plugin already adds the oneJar to the artifacts. I would assume, that I need to add these lines myself:

artifacts {
    archives oneJar
}

Do you agree in letting the user add the artifact himself?

rholder commented 11 years ago

Hmm, that does limit the ability to configure which tasks should and shouldn't publish their artifacts when you're OneJar'ing things. You're right, the more flexible solution would be to have the user be the one responsible for adding their own artifacts explicitly instead of just making the assumption that you always publish a OneJar archive when that type of task is part of the project. I'll take a closer look at this later tonight to figure out how to best approach it. Also, feel free to fork it and open a pull request if you want to take a crack at fixing it before I get to it.

joschi commented 11 years ago

The fix seems to be straight forward by just removing the creation of the PublishArtifact inside the OneJar task completely.