Hi,
Thanks for your answer.
I'll try to explain better what I am trying to do.
I have an artifact, say, com.mycompany.ant-build-utils containing ant
scripts that do some interaction with SCM an CI, that we need to use during
the build. Now, as you say, it is untarred manually on a shared drive and
called directly from a build script that is in every project.
So every project we have has a pom.xml, and a build.xml. The build.xml is
called either by maven via the ant plugin, or invoked directy from the
command line using ant for the particular task I am discussing.
What I would like to do, is to use the scripts that are in my
com.mycompany.ant-build-utils via maven, and I thought the best way to do
that was to create a plugin (I chose an ant-based plugin).
My plugin, say com.mycompany.ci-plugin has a pom that will look like this :
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>ci-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<name>CI plugin</name>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-script-ant</artifactId>
<version>2.0.6</version>
</dependency>
<dependency>
<groupId>com.mycompany</groupId>
<artifactId>ant-build-utils</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
<version>2.5</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools-ant</artifactId>
<version>2.5</version>
</dependency>
</dependencies>
<configuration>
<goalPrefix>update-ci</goalPrefix>
</configuration>
</plugin>
</plugins>
</build>
</project>
and has an ant mojo like this :
<project>
<target name="refresh-job">
....
Here we should call the ant script from ant-build-scripts
....
</target>
</project>
My problem is, as you see, to be able to fetch the ant-build-scripts when
the plugin is used from another project, and execute a target from it.
One solution I guess would be to explicitly call maven from my mojo to copy
and unpack the deps, but it is a solution I would like to avoid as it
breaks the standard maven process.
I hope my explanations were clear,
Thanks for your interest,
Arnaud
2013/5/17 Baptiste Mathus <[email protected]>
> Hi,
> Not sure I understand what your issue is.
> Are you depending on some filesystem path?
> What's the displayed error?
>
> -- Baptiste
> Le 16 mai 2013 18:42, "arnaud dufranne" <[email protected]> a écrit :
>
> > Hi,
> >
> > I am currently looking into writing an ant based maven plugin. My main
> > issue is that this plugin depends on an artifact (tar.gz in a company
> > repository) containing a few ant scripts, whose tasks should be run when
> > using the plugin.
> >
> > I declared the dependency in my plugin's pom.xml, and the plugin builds
> and
> > installs fine.
> >
> > When using the plugin from another project, the dependency to my ant
> > artifact is not pulled from the repository, so not visible from my ant
> > plugin.
> >
> > I have seen other discussions where the path to the scripts would be hard
> > coded in the plugin, but my goal is to keep my ant library nicely
> packaged
> > and to avoid this solution.
> >
> > Does anyone have any experience in doing that kind of things ?
> >
> > Thanks for you input,
> >
> > Arnaud
> >
>