Hello,

I have a WAR project with several subproject that the WAR depends on.  When
I generate the WAR, I would like for the sub-project JARs to be bundled
inside the war.  However, all transitive and compile time dependencies
should be copied to an external folder/zip.  For example, suppose I have the
following:

/WebApplication
  /lib
/SubProjectA
  /lib
/SubProjectB
  /lib
/build.gradle
/settings.gradle

When I generate the WAR from the WebApplication, I would like the following
files produced:

webApplication.WAR.  It would contain
/lib/subProjectA.jar
/lib/subProjectB.jar

.... and a separate zip file would contain all of the other dependencies
(both compile-time and run-time for the WebApplication and each sub
project). Like

otherJars.zip
  /junit-addons-1.4.jar
  /xmlunit-1.2.jar
  /someJar-1.0.jar

My build.gradle currently looks something like this:

subprojects {
    usePlugin('java')
    version = '1.0'
    sourceCompatibility = 1.6
    targetCompatiblity = 1.6
}

/*
add the ability for the WAR to find all of the repositories of it's
sub-projects.  That way,
it can bundle all of the dependent runtime jars from the sub-projects
*/
allprojects { 
        afterEvaluate { project -> 
                project.configurations.each { config -> 
                        config.getDependencies(ProjectDependency.class).each 
{dep -> 
                                dep.dependencyProject.repositories.each {repos 
-> 
                                        if 
(!project.repositories.all.contains(repos)) { 
                                                        
project.repositories.add(repos) 
                                        } 
                                } 
                        } 
                } 
        } 
}

project(":SubProjectA") {
        dependencies {
                compile name: 'junit-addons', version: '1.4'
                runtime group: 'xmlunit', name: 'xmlunit', version: '1.2'
        }
}

project(":SubProjectB") {
        dependencies {
                compile project(":SubProjectA")
                compile group: 'junit-addons', name: 'junit-addons', version: 
'1.4'
                runtime group: 'xmlunit', name: 'xmlunit', version: '1.2'
        }
}

project(":WebApplication") {
        usePlugin('war')
        dependencies {
                compile project(":SubProjectB")
                runtime name 'someJar', version: '1.0'
        }
}

-----------
I don't understand what task to intercept/override to perform this kind of
filtering.  My real project has more subprojects and dependent JARs. That's
why I programmatically find all dependent transitive jars 'afterEvaluate' is
called.

Any ideas?

Andrew 

-- 
View this message in context: 
http://www.nabble.com/Only-bundle-sub-project-jars-in-WAR--not-transitive-depencies-tp25965185p25965185.html
Sent from the gradle-user mailing list archive at Nabble.com.


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

    http://xircles.codehaus.org/manage_email


Reply via email to