(参见下面的修改。)
我不能只使用类路径的原因,是因为我需要管理一些非Java库,而且我编译非Java项目。
我想在antrun呼叫使用Maven依赖关系,在Maven站点文档以下内容:
http://maven.apache.org/plugins/maven-antrun-plugin/examples/classpaths.html
在页面的底部:
<property name="mvn.dependency.jar"
refid="maven.dependency.my.group.id:my.artifact.id:classifier:jar.path"/>
<echo message="My Dependency JAR-Path: ${mvn.dependency.jar}"/>
我不能做这项工作,无论我如何努力。 我试过$ {}周围的REFID内容,我试过冒号,句号等。在每一个方式,我能想到的分隔符。
谁能告诉我这是什么REFID 真的应该像一些常见的依赖?
编辑:
感谢您的回复。
使用你的榜样SingleShot,我有以下几点:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>create-messages</id>
<phase>compile</phase>
<configuration>
<tasks>
<property name="build.compiler" value="extJavac"/>
<property name="compile_classpath" refid="maven.compile.classpath"/>
<property name="runtime_classpath" refid="maven.runtime.classpath"/>
<property name="test_classpath" refid="maven.test.classpath"/>
<property name="plugin_classpath" refid="maven.plugin.classpath"/>
<property name="log4j.jar" refid="log4j:log4j:jar"/>
<echo message="Where is the Log4J JAR?: ${log4j.jar}"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
</dependencies>
</plugin>
这里就是我得到的运行时编译MVN:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Chat Component
[INFO] task-segment: [compile]
[INFO] ------------------------------------------------------------------------
Downloading: http://<redacted>/content/groups/public/log4j/log4j/1.2.14/log4j-1.2.14.pom
2K downloaded
Downloading: http://<redacted>/content/groups/public/log4j/log4j/1.2.14/log4j-1.2.14.jar
358K downloaded
[INFO] [antrun:run {execution: create-messages}]
[INFO] Executing tasks
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error executing ant tasks
Embedded error: Reference log4j:log4j:jar not found.
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Fri Oct 16 14:54:19 PDT 2009
[INFO] Final Memory: 7M/80M
[INFO] ------------------------------------------------------------------------
EDIT(2):
纵观源代码链接,我决定运行“命令mvn -X编译”和grep为“存储”,这变成了哪里获得存储的东西一大堆的输出日志。
令人感兴趣的是,我明确指定的依赖并不在列表中显示的事实,并且,当我切换到基于我看到其中一个条目的关键,我仍然得到错误。