On 13/03/10 3:58 PM, Geronimo M. H. wrote:
Hello,

my multi-project build has grown that much, that I decided to split the major
project. At the same time I thought about build automatization, so I
discovered ivy and then gradle and I'm quite intrigued about gradle.
I'm new to gradle and groovy - so I worked out most samples from the userguide
and read the ML for more hints.

My ant-scripts have been created for ant-1.65 and they stil work with ant-1.70
but they don't work with gradle (via import).
I tried gradle 0.8 and gradle from git.
So I'm looking for a helping hand.

All my projects have the layout:
subproject
    src
    test
    res

and they all use a shared library location 'common/3rdParty' for external
jars, which looks like:

common/3rdParty/commons-dbcp/commons-dbcp-1.2.2.jar
common/3rdParty/commons-logging/commons-logging-1.1.1.jar
common/3rdParty/commons-logging/commons-logging-adapters-1.1.1.jar
common/3rdParty/commons-logging/commons-logging-api-1.1.1.jar
common/3rdParty/commons-pool/commons-pool-1.4.jar
common/3rdParty/glazedlists/glazedlists_java15.jar
common/3rdParty/jgoodies/binding/binding-2.0.6.jar
common/3rdParty/jgoodies/forms/forms-1.2.1.jar
common/3rdParty/jgoodies/looks/looks-2.3.0.jar
common/3rdParty/spring/spring-beans.jar
common/3rdParty/spring/spring-context.jar
common/3rdParty/spring/spring-core.jar
common/3rdParty/spring/spring-jdbc.jar
common/3rdParty/spring/spring-tx.jar

With ant I'm doing this (with later pathconvert):

<import file="../common.xml"/>
<path id="compile.classpath">
    <fileset dir="${lib.dir}/commons-logging">
      <include name="**/*.jar" />
    </fileset>
    <fileset dir="${lib.dir}/jgoodies/binding">
      <include name="**/*.jar" />
    </fileset>
    <fileset dir="${lib.dir}/jgoodies/forms">
      <include name="**/*.jar" />
    </fileset>
    <fileset dir="${lib.dir}/spring">
      <include name="**/*.jar" />
    </fileset>
</path>
<path id="ref.classpath">
    <fileset file="${prj.lib.dir}/subPrjAlib.jar"/>
    <fileset file="${prj.lib.dir}/subPrjBlib.jar"/>
    <fileset file="${prj.lib.dir}/subPrjClib.jar"/>
</path>

So all subprojects use some jars from common/3rdParty, but not every
subproject uses all jars.

I'd like to keep the project layout and the shared lib-dir, but add a (local)
repository with dependencies, where I could install the jars from the
subprojects - to automate distribution.

I startet with a build.gradle like that:

allprojects {
    apply id: 'java'
    group = 'my.group'
    version = '0.1'

    sourceSets {
       main {
          java {
             srcDir = 'src'
          }
          resources {
             srcDir = 'res'
          }
       }
       test {
          java {
             srcDir = 'test'
          }
          resources {
             srcDir = 'test'
          }
       }
    }
}

but I did not find a way to setup the classpath for the shared lib-directory.
I tried:

repositories {
    add(new org.apache.ivy.plugins.resolver.FileSystemResolver()) {
       name = 'local'
       addArtifactPattern(new File('common/3rdParty').getAbsolutePath() +
          '/([organization]/)[module]/[artifact](-[revision])(-[classified]).
[ext]')
    }
}

but I guess, that was not the right way, as the shared lib-dir is not the
repository?!?

What is going wrong with the above? What are you seeing that suggests that its not working?

How can I use the jars from the shared lib-dir without caring about the
jar-releases. I'd like to handle the releases in the transfer from repository
to the shared lib-dir.

When does the artifact-pattern come into play?

Furthermore I'd like to extract my project-layout and the settings about the
shared lib-dir to a property-file, that is shared by all major projects
(several toplevel build.gradle). How can I to that?


I would use some of the features available in a recent Gradle 0.9 snapshot (we haven't released 0.9 yet, but we're gearing up to do so soon). More specifically, I would extract this stuff into a separate build script, which can then be applied from multiple builds.

There's a bit of information at http://gradle.org/latest/docs/userguide/tutorial_this_and_that.html#sec:configuring_using_external_script


--
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