【发布时间】:2013-03-06 19:29:17
【问题描述】:
说明:
我目前在 Netbeans 中有一个 Java Web 项目,并且我正在使用 Maven。最近我更改了项目中的pom,以便在构建时生成2个war文件:一个用于开发(我希望Netbeans在选择“运行项目”时部署它),另一个用于生产。
为了在以前的部署中保持一定的标准,我将生产 WAR 保留为相同的(默认)名称 ReportsPortal.war,而开发版本则附加了 -dev。
参考:
这是我更改的pom 文件的部分:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<id>package-prod</id>
<phase>package</phase>
<configuration>
<webResources>
<resource>
<directory>src/main/env/prod</directory>
</resource>
</webResources>
</configuration>
<goals>
<goal>war</goal>
</goals>
</execution>
<execution>
<id>package-dev</id>
<phase>package</phase>
<configuration>
<classifier>dev</classifier>
<webResources>
<resource>
<directory>src/main/env/dev</directory>
</resource>
</webResources>
</configuration>
<goals>
<goal>war</goal>
</goals>
</execution>
</executions>
</plugin>
它会生成两个文件(ReportsPortal.war 和 ReportsPortal-dev.war)。每个都有其环境变量(并且它们之间不同)。
当右键单击 ReportsPortal 项目并选择 Run 时,Netbeans 会启动 Tomcat,并且部署的应用程序具有正确的值,所以我猜它正在使用 ReportsPortal-dev.war,但我不能确定。
我的问题:
我如何知道或更改 Netbeans 用于在 Tomcat 中部署的 war 文件?
【问题讨论】:
标签: java maven tomcat netbeans