Rafael Serrano wrote:
Hi all,

I'm using gradle's multi-project builds in order to simplify several related
projects, but I'm not guessing how to import / export artifacts among them.

My use case: I have two projects using the WAR plugin, and they work as
consumer / producer. "Producer" is deployed as a WAR, but also generates a
JAR used by "consumer". The problem is that depending on "Producer" means
both on the JAR and the WAR, but I want to exclude the WAR. How can this be
done?

Here are the two snippets of my build.gradle files (my master project does
not declare any dependency):
build.gradle (remoteService)
...
jar.enabled = true
artifacts {
        archives jar
}

build.gradle (client)
...
compile project(':remoteService) {
        transitive = false
}

Thanks in advance. Regards
Rafa

There's a JIRA issue for this problem: http://jira.codehaus.org/browse/GRADLE-687

One possible work around is to remove the war artifact from the archives configuration:
remoteService/build.gradle

configurations.archives.artifacts.each {
 if (it.archiveTask == war) {
   configurations.archives.removeArtifact(it)
 }
}

jar.enabled = true
artifacts {
  archives jar
}


Another option is to use a different configuration for project dependencies:

configurations {
  projectDependency
  runtime {
       extendsFrom = [projectDependency] as Set
 }
}

jar.enabled = true
artifacts {
   projectDependency jar
}


--
Adam Murdoch
Gradle Developer
http://www.gradle.org


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to