Netbeans正在部署哪种WAR?

时间:2013-03-06 19:29:17

标签: java maven tomcat netbeans

解释

我目前在Netbeans中有一个Java Web项目,我正在使用Maven。最近我更改了项目中的pom,以便在构建时生成2个war文件:一个用于开发(我希望Netbeans在选择&#34时运行;运行项目"),另一个用于生产。

为了在以前的部署中保持一定的标准,我使用相同(默认)名称ReportsPortal.war和附加-dev的开发版本保留了生产WAR。

参考:

这是我更改的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.warReportsPortal-dev.war)。每个都有它的环境变量(和它们之间的不同)。

右键单击ReportsPortal项目并选择运行,Netbeans启动Tomcat,部署的应用程序具有正确的值,因此我猜它正在使用ReportsPortal-dev.war,但我可以&#39;可以肯定的。

我的问题:

如何知道或更改Netbeans用于在Tomcat中部署的war文件?

1 个答案:

答案 0 :(得分:0)

您应该为每个war文件创建单独的maven构建配置文件。然后,您可以在执行开发工作时调用开发配置文件,并仅在要进行发布时才调用生产配置文件。这将允许您准确控制正在构建的内容。

相关问题