[
http://jira.codehaus.org/browse/MANTRUN-41?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_119538
]
Roman Urich commented on MANTRUN-41:
------------------------------------
I have fixed this problem so:
class AbstractAntMojo:
...
107 /* set maven.plugin.classpath with plugin dependencies */
antProject.addReference( "maven.plugin.classpath",
getPathFromArtifacts( pluginArtifacts, antProject ) );
+
+ if (pluginArtifacts != null) {
+ for (Iterator i = pluginArtifacts.iterator();
i.hasNext();) {
+ Artifact a = (Artifact) i.next();
+ File file = a.getFile();
+ if (file == null) {
+ throw new
DependencyResolutionRequiredException(a);
+ }
+
+ String id = "maven:" + a.getGroupId() +
":" + a.getArtifactId() + ":" + a.getType();
+ // String id = "maven:" +
a.getGroupId() + ":" + a.getArtifactId() + ":" + a.getBaseVersion() + ":" +
a.getType();
+ Path path = new Path(antProject);
+ path.setPath(file.getPath());
+ antProject.addReference(id, path);
+ }
+ }
...
Usage (pom.xml):
...
<plugin>
<groupId>ponton.product.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<dependencies>
<dependency>
<groupId>my.group.id</groupId>
<artifactId>my.artifact.id</artifactId>
<version>my.version</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<property
name="mvn.dependency.jar" refid="maven:my.group.id:my.artifact.id:jar"/>
<echo
message="My Dependency JAR-Path: ${mvn.dependency.jar}"/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
...
> Easy access to dependency jars
> ------------------------------
>
> Key: MANTRUN-41
> URL: http://jira.codehaus.org/browse/MANTRUN-41
> Project: Maven 2.x Antrun Plugin
> Issue Type: New Feature
> Affects Versions: 1.1
> Reporter: Patrick Lightbody
> Assignee: Kenney Westerhof
> Fix For: 1.2
>
> Attachments: MANTRUN-41-maven-antrun-plugin.patch
>
>
> It would be nice to have an easy access to the dependency jars located in
> ~/.m2. A couple ideas tossed around in #maven were:
> ${dep.XXX.YYY.jar}, where XXX and YYY are the groupId and artifactId
> OR
> a new Ant task:
> <maven:dep artifactId=... property="jarpath"/>
> Where you could then reference ${jarpath}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira