You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by EJ Ciramella <ej...@upromise.com> on 2007/02/19 20:40:08 UTC

unable to get dependency classpath passed to an ant script

We're still in process of converting from a strictly ant build to a
maven 2 build and we're relying on a few snippets ouf of our old ant
scripts.  Currently, one is really throwing us for a loop:
 
   <build>
      <resources>
         <resource>
            <directory>src/main/scripts</directory>
            <targetPath>../scripts</targetPath>
            <filtering>false</filtering>
         </resource>
         <resource>
            <directory>src/main/resources</directory>
         </resource>
      </resources>
      <plugins>
         <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
               <descriptor>src/main/assembly/dep.xml</descriptor>
            </configuration>
         </plugin>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
               <execution>
                  <phase>generate-sources</phase>
                  <configuration>
                     <tasks>
                        <ant antfile="build.xml" inheritRefs="true">
                           <target name="generate-pdt-source"/>
                        </ant>
                     </tasks>
                  </configuration>
                  <goals>
                     <goal>run</goal>
                  </goals>
               </execution>
            </executions>
            <dependencies>
               <dependency>
                  <groupId>castor</groupId>
                  <artifactId>castor_xml</artifactId>
                  <version>0.9.4.3</version>
               </dependency>
               <dependency>
                  <groupId>xerces</groupId>
                  <artifactId>xercesImpl</artifactId>
                  <version>2.8.0</version>
               </dependency>
            </dependencies>
         </plugin>
      </plugins>
   </build>
 
   <target name="generate-pdt-source" depends="check-pdt-source"
unless="castor.generate.required">
      <delete dir="${pdt.source.dir}"/>
      <delete dir="${castor.target.dir}"/>
      <property name="coolcp" refid="maven.plugin.classpath"/>
      <echo message="${coolcp}"/>
            <property name="coolcp2"
refid="maven.dependency.classpath"/>
      <echo message="${coolcp2}"/>
      <java classname="org.exolab.castor.builder.SourceGenerator">
         <arg value="-dest"/>
         <arg value="${castor.target.dir}"/>
         <arg value="-types"/>
         <arg value="j2"/>
         <arg value="-i"/>
         <arg value="${castor.schemafile}"/>
         <arg value="-f"/>
         <arg value="-package"/>
         <arg value="com.upromise.pdt.castor"/>
         <classpath>
            <pathelement location="${castor.source.dir}"/>
         </classpath>
         <classpath refid="maven.plugin.classpath"/>
      </java>
      <copy todir="${pdt.target.dir}">
         <fileset dir="${pdt.source.dir}"/>
      </copy>
      <touch file="${castor.touchfile}"/>
   </target>
 
What's really nuts is on SOME people's machines this works, on others it
doesn't.  Does anyone see anything out of line?

RE: unable to get dependency classpath passed to an ant script

Posted by Barrett Nuzum <Ba...@Valtech.com>.
Hey EJ.
 
I don't see anything wrong with your ant, per se.
 
However, if you have a multi-module build,
maven.*.classpath does not resolve correctly when building children of the parent.
 
That is to say --
        ParentProject/
         --- pom.xml
         --- Child Project/
              --- pom.xml
 
Running the goals when in ChildProject will result in a working antrun build with the appropriate classpaths, but running the same goals from ParentProject will result in all the classpaths not resolving correctly.
 
This is a known issue.
http://jira.codehaus.org/browse/MANTRUN-37
 
There are a number of other issues with Antrun that might also be relevant.
 
Hope that helps.
 
Barrett
 
::   
Barrett Nuzum
Consultant, Skill Development
Direct: 918.640.4414
Fax: 972.789.1340 

Valtech Technologies, Inc.
5080 Spectrum Drive
Suite 700 West
Addison, Texas 75001
www.valtech.com <http://www.valtech.com>   
making IT business friendly


________________________________

From: EJ Ciramella [mailto:ejciramella@upromise.com]
Sent: Mon 2/19/2007 1:40 PM
To: Maven Users List
Subject: unable to get dependency classpath passed to an ant script



We're still in process of converting from a strictly ant build to a
maven 2 build and we're relying on a few snippets ouf of our old ant
scripts.  Currently, one is really throwing us for a loop:

   <build>
      <resources>
         <resource>
            <directory>src/main/scripts</directory>
            <targetPath>../scripts</targetPath>
            <filtering>false</filtering>
         </resource>
         <resource>
            <directory>src/main/resources</directory>
         </resource>
      </resources>
      <plugins>
         <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
               <descriptor>src/main/assembly/dep.xml</descriptor>
            </configuration>
         </plugin>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
               <execution>
                  <phase>generate-sources</phase>
                  <configuration>
                     <tasks>
                        <ant antfile="build.xml" inheritRefs="true">
                           <target name="generate-pdt-source"/>
                        </ant>
                     </tasks>
                  </configuration>
                  <goals>
                     <goal>run</goal>
                  </goals>
               </execution>
            </executions>
            <dependencies>
               <dependency>
                  <groupId>castor</groupId>
                  <artifactId>castor_xml</artifactId>
                  <version>0.9.4.3</version>
               </dependency>
               <dependency>
                  <groupId>xerces</groupId>
                  <artifactId>xercesImpl</artifactId>
                  <version>2.8.0</version>
               </dependency>
            </dependencies>
         </plugin>
      </plugins>
   </build>

   <target name="generate-pdt-source" depends="check-pdt-source"
unless="castor.generate.required">
      <delete dir="${pdt.source.dir}"/>
      <delete dir="${castor.target.dir}"/>
      <property name="coolcp" refid="maven.plugin.classpath"/>
      <echo message="${coolcp}"/>
            <property name="coolcp2"
refid="maven.dependency.classpath"/>
      <echo message="${coolcp2}"/>
      <java classname="org.exolab.castor.builder.SourceGenerator">
         <arg value="-dest"/>
         <arg value="${castor.target.dir}"/>
         <arg value="-types"/>
         <arg value="j2"/>
         <arg value="-i"/>
         <arg value="${castor.schemafile}"/>
         <arg value="-f"/>
         <arg value="-package"/>
         <arg value="com.upromise.pdt.castor"/>
         <classpath>
            <pathelement location="${castor.source.dir}"/>
         </classpath>
         <classpath refid="maven.plugin.classpath"/>
      </java>
      <copy todir="${pdt.target.dir}">
         <fileset dir="${pdt.source.dir}"/>
      </copy>
      <touch file="${castor.touchfile}"/>
   </target>

What's really nuts is on SOME people's machines this works, on others it
doesn't.  Does anyone see anything out of line?



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org