我需要将所有已编译的类文件作为jar导出到本地testserver的目录中。我想让maven自动执行此操作。
<!-- Build instructions -->
<build>
<finalName>${project.artifactId}</finalName>
<defaultGoal>compile package</defaultGoal>
<sourceDirectory>${basedir}/src/</sourceDirectory>
<outputDirectory>/home/...</outputDirectory> <!--only class files go here, not the jar-->
<resources>
<resource>
<includes>
<include>plugin.yml</include>
</includes>
<directory>${basedir}</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
构建我首先清理然后通过IntelliJ的Maven插件打包。当我打包时,我希望它将jarfile打包到我的testserver中,这样我就不必在每次构建后手动移动它。
答案 0 :(得分:0)
使用Maven Ant plugin
自定义特定目标后的内容:
答案 1 :(得分:0)
您需要根据您的要求配置maven-jar-plugin并配置其outputDirectory,您可以在此链接上查看详细信息。 http://maven.apache.org/plugins/maven-jar-plugin/jar-mojo.html