我目前正在将我的ANT构建文件转换为maven,并且遇到了一些问题。
我有一些类,如果你运行它们的main-method,它们会自动为自己生成文档文件。我的构建过程的一部分是运行这些主要方法,将输出保存为文本文件,然后将它们上传到项目网站。
我的ANT-target看起来像这样:
<target name="generate-protocol-doc" depends="build">
<java classname="abc.Protocol" output="builds/protocol.txt">
<classpath refid="classpath" />
</java>
</target>有没有办法在maven中做同样的事情?
发布于 2011-01-27 06:12:26
正如Peter Lawrey指出的那样,有一个名为Antrun的插件,它可以让你在maven中运行原生Ant代码。这是我的最终解决方案:
<build>
<!-- ... -->
<plugins>
<!-- ... -->
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<configuration>
<target>
<!-- It won't output to file unless the vm forks, apparently -->
<java classname="abc.Protocol" output="builds/protocol.txt" fork="true">
<classpath refid="maven.compile.classpath" />
</java>
</target>
</configuration>
</plugin>
<!-- ... -->
</plugins>
<!-- ... -->
</build>发布于 2011-01-27 04:46:41
您可以使用Maven exec plugin。
https://stackoverflow.com/questions/4808584
复制相似问题