You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by shinjan sen <sh...@gmail.com> on 2007/06/26 06:00:30 UTC

Executing Ant script before downloading dependencies | Need Help

Hi,
Can anyone please suggest a workaround if this is possible.

Many Thanks
Shinjan


On 6/25/07, shinjan sen <sh...@gmail.com> wrote:
>
> Hi,
> I have a maven project which has a dependency on an ant project. To
> achieve this I have added a execution of the maven ant-run-plugin in my
> pom.xml as follows:
>
>  <plugin>
>    <groupId>org.apache.maven.plugins</groupId>
>    <artifactId>maven-antrun-plugin</artifactId>
>    <executions>
>     <execution>
>      <phase>package</phase>
>      <configuration>
>      <tasks>
>      <echo>Download dependent jars</echo>
>      <ant antfile="build.xml" dir="." inheritAll="true"
> inheritRefs="true">
>      </ant>
>      </tasks>
>      </configuration>
>      <goals>
>           <goal>run</goal>
>               </goals>
>     </execution>
>    </executions>
>    </plugin>
>
> This ant script "build.xml" compiles the associated ant project and
> installs the same in the maven local repository.
>
> <project basedir="." default="buildJar" >
>  <condition property="mvn.exec" value="mvn.bat" else="mvn">
>    <os family="windows"/>
>  </condition>
>  <target name="buildJar" description="Builds ant project and copies jar to
> local repository">
>   <ant antfile="build.xml" dir="ant_common" target="compile" />
>   <exec executable="${mvn.exec}">
>    <arg line="-D mvn install:install-file -Dfile=ant_common.jar
> -DgroupId=mytest -DartifactId=ant_common -Dversion=1.0 -Dpackaging=jar"/>
>   </exec>
>  </target>
> </project>
>
> My question is how do I add this ant project as a dependency in my pom.xml?
> if I add it as
>    <dependency>
>       <groupId>mytest</groupId>
>       <artifactId>ant_common</artifactId>
>       <version>1.0</version>
>     </dependency>
> my pom will try to download the same before executing the
> maven-antrun-plugin execution and will throw an error.
>
> I want to achieve the effect of installing the ant project and then
> referencing it as a dependency in one execution.
>
> Please advise.
>
> Thanks in advance.
>
> Regards,
> Shinjan
>
>