hi,

I have a multi project build. the upstream is a java project that produces
2 jar artifacts. The 2nd artifact is generated with:

task customJar(type: Jar, dependsOn: customTaskClasses) {
    classifier = 'custom'
    from sourceSets.customTask.classes
    includes = ["com/**"]
    excludes = ["**/client"]
}

artifacts {
    archives customJar
}


The downstream project is a war project, with a default war task and an
additional war task, generating 2 war artifacts. It has a dependency on the
upstream, declared as:

compile project(":upstream")
customWar project(":upstream")

The default war artifact requires the default artifact from upstream, but
NOT the customJar. The customWar requires both artifacts.

How would I exclude the customJar artifact from the default war?

I have tried the following:

// exclude filter on war task.
war { excludes = ["**/*-custom.jar"] }

// setting the dependency based on the upstream's runtime configuration:
compile project(path: ":upstream", configuration: "runtime")
// fails with "configuration not public" -
http://comments.gmane.org/gmane.comp.programming.tools.gradle.user/7252

// setting the dependency to the upstream's main classes:
compile project(":upstream").sourceSets.main.classes
// transitive dependencies are not resolved - classpath issues result in
classnotfound exceptions.


Perhaps a war.doLast that repacks the war, filtering out the custom jar?

Regards,

Reply via email to