之所以采用Maven调用ant 进行编译,是因为有一些lib 并不在远程仓库里,而是直接放到project/lib目录下。
编译的时候要依赖这些lib包, maven里好像没什么办法把这些非仓库里的lib包加入到classpath中来,才采用调用ant的方式。
ps: 但是如果要采用这种把非仓库lib的加入到classpath的方式,就无法使用maven官方推荐的maven-ant-tasks进行抽取pom的dependency,所以我在这个例子中把那段注释掉了。。
这是不是一个maven的bug?
----------------------------------------------------------------------------
Pom.xml:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<id>ant-build</id>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<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 na