私はMaven 3.0.3を使用しています。 WARファイルをパッケージ化する前に、環境固有のプロパティをコピーするタスクを実行します。以下は私の仕事です。私の仕事にはどのような段階がありますか?
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<delete file="${project.build.outputDirectory}/environment.properties"/>
<copy file="src/main/resources/${env}_environment.properties"
tofile="${project.build.outputDirectory}/environment.properties" />
<delete file="${project.build.outputDirectory}/${env}_hibernate.cfg.xml"/>
<copy file="src/main/resources/${env}_hibernate.cfg.xml"
tofile="${project.build.outputDirectory}/hibernate.cfg.xml" />
<echo message="Copied ${env}_hibernate.cfg.xml properties. " />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
しかし、実行することによって、私のTomcatのプロファイルからゴールを呼び出し、私のアプリを起動したときに「MVN -P TomcatのTomcatを:運転」、上記のタスクが実行を取得していません。どのように私はこれを修正することができる任意のアイデア?私が含むTomcatのプロファイルは以下の通りです。 - デイブ
<profile>
<id>tomcat</id>
<activation>
<property>
<name>env</name>
<value>dev</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<charset>UTF-8</charset>
<path>/leadsmonitor</path>
<server>nnadbmon-tomcat</server>
<update>true</update>
<url>http://nnadbmon.mydomain.com:8080/manager</url>
<warFile>target/leadsmonitor.war</warFile>
<systemProperties>
<JAVA_OPTS>-Xms256m -Xmx512m -XX:MaxPermSize=256m -XX:NewRatio=6 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -verbose:gc"</JAVA_OPTS>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
</profile>
コンパイルフェーズに何を添付しますか? – Dave
申し訳ありませんが、私はant-run-pluginを参照していました。それはあなたのためにそれを行う必要があります。 – carlspring