1) Do what you are doing now.
2) Create on dependencies.xml (project.xml style) with ALL artifacts and 
dependencies.
  (problem is that it will not download anything, in my case it was a solution 
:)
3) Do something like this in a goal :
     <u:available file="${basedir}/dependencies.xml">
       <maven:pom var="realPom" 
projectDescriptor="${basedir}/dependencies.xml"/>
     </u:available>
     <j:if test="${realPom == null}">
       <ant:echo>dependencies.xml not found, assuming dependencies are in project.xml 
itself!</ant:echo>
     </j:if>
     <j:if test="${realPom != null}">
       ${pom.setArtifacts(realPom.artifacts)}
       ${pom.setDependencies(realPom.dependencies)}
     </j:if>

5) (probably) download the libraries, if not needed, that will help.
6) Add the found artifacts to your classpath (instead of the one  you found 
with ant)

I used this to seperate between source dependencies (that needed source 
dependencies) and real jar dependencies (like commons-collections).

Don't know if it is usable for your scenario, but you can get a lot done this 
kind of way. The problem with this solution might be a lock in to a certain 
version of maven (in this case I know it works in 1.0.2).

In short : hope it is usefull for you ;)

Mvgr,
Martin

Matthew Wheaton wrote:
Hi all,

In Maven 1.x, I could get a list of the jars in my version control
repository, and dynamically add them to the Maven build path using an ant
task.
What's important to note, is that I have all my dependency jars in a few,
KNOWN directories. I would like to be able to include all those jars,
without having to reference each one of them explicitly in a POM, or a
parent POM. Below is how I do this in Maven 1.x with the ANT task. Note
below, that I can create the ant goal, however, the last line in the goal,
seems to be only an Maven 1.x feature and not possible in Maven 2.x.

In our environment, we may have totally different people developing that the
people doing the build. When a developer adds new JARs to version control,
it will break the build, unless we manually add the reference in all the
associated POMs (or parent POMs). We're trying to avoid this, any ideas ?

Below is my Maven 1.x ANT goal.

    <goal
        name="build:SetClasspath"
        description="Sets the classpath">

    <echo message="Setting the compile classpath . . ." />

    <ant:path id="all.libs.path">

      <!-- get all the deployment libs -->
      <ant:fileset dir="${build.deployLibs}">
        <ant:include name="**/*.*" />
      </ant:fileset>

      <!-- get all the compile only libs -->
      <ant:fileset dir="${build.compileLibs}">
        <ant:include name="**/*.*" />
      </ant:fileset>
    </ant:path>

    <m:addPath id="maven.dependency.classpath" refid="all.libs.path" />


  </goal>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to