Skip to content

uploadX task fails if both shadow 2.0.x and application plugin are applied. #347

@huxi

Description

@huxi

Shadow Version

1.2.4 vs. 2.0.0/2.0.1

Gradle Version

4.3.1/4.4-rc1

Expected Behavior

This example project (build.gradle is also provided below) should work with 2.0.x since it worked with 1.2.4.
Execute gradlew to run the default tasks.

Actual Behavior

Execution failed for task ':uploadPublished'.
> Could not publish configuration 'published'
   > A POM cannot have multiple artifacts with the same type and classifier. Already have MavenArtifact gradle-shadow2:zip:zip:null, trying to add MavenArtifact gradle-shadow2:zip:zip:null.

If you remove the following two lines, the build will work.

apply plugin: 'application'
mainClassName = 'foo.Main'

If you instead switch back from 2.0.1 to 1.2.4, the build will work.
If you use Gradle 4.4-rc1, neither will work. See gradle/gradle#3589

Gradle Build Script(s)

buildscript {
    repositories {
    	jcenter()
    }

    dependencies {
        //classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.4'
        classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.1'
    }
}

wrapper {
    gradleVersion = '4.3.1'
    // gradleVersion = '4.4-rc1'
}

description = 'some description'
version = '1.0.0-SNAPSHOT'

def localReleaseRepoFile = new File("${System.properties.'user.home'}/local-gradle-repository/release")
def localSnapshotRepoFile = new File("${System.properties.'user.home'}/local-gradle-repository/snapshot")
def localReleaseRepo = localReleaseRepoFile.toURL().toString()
def localSnapshotRepo = localSnapshotRepoFile.toURL().toString()
repositories {
	maven {
		url localReleaseRepo
	}
	maven {
		url localSnapshotRepo
	}
	mavenCentral()
	mavenLocal()
}

apply plugin: 'application'
mainClassName = 'foo.Main'

apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'com.github.johnrengelman.shadow'


def deployer = null

configurations {
	published.extendsFrom archives
}

uploadPublished {
	deployer = repositories.mavenDeployer {
		repository(url: localReleaseRepo)
		snapshotRepository(url: localSnapshotRepo)
	}
}

def defaultProject= {
	url 'http://foobar.com'
	name project.name
	description project.description
}


def installer = install.repositories.mavenInstaller

installer.pom.project defaultProject

deployer.pom.project defaultProject

defaultTasks 'build', 'shadowJar', 'uploadPublished'

Content of Shadow JAR (jar tf <jar file> - post link to GIST if too long)

n/a, content of the JAR is not the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions