我在下面使用xml创建了一个自定义netbeans操作。
<action>
<actionName>CUSTOM-mvn redeploy</actionName>
<displayName>mvn redeploy</displayName>
<properties>
<netbeans.deploy>true</netbeans.deploy>
<netbeans.deploy.debugmode>true</netbeans.deploy.debugmode>
</properties>
<goals>
<goal>compile</goal>
<goal>war:exploded</goal>
<goal>tomcat7:redeploy</goal>
</goals>
</action>
问题是当使用netbeans.deploy元素时,它会取消部署war。
tomcatManager status code:200, ReasonPhrase:OK
OK - Deployed application at context path /myservice
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 25.510 s
Finished at: 2015-07-28T14:51:21+08:00
Final Memory: 37M/367M
------------------------------------------------------------------------
NetBeans: Deploying on Apache Tomcat or TomEE
profile mode: false
debug mode: true
force redeploy: true
<b>Undeploying ...
undeploy?path=/myservice
OK - Undeployed application at context path /myservice
给任何可能需要的人。不知何故,我通过在pom.xml中添加配置文件解决了这个问题。然后,您添加的概要文件将成为一个配置。将您的自定义操作添加到该配置
<profiles>
<profile>
<id>dev</id>
<build>
<finalName>myservice</finalName>
</build>
</profile>
不确定作者使用的是哪个版本的Netbeans,但从Netbeans 12.2开始,请参阅:https://issues.apache.org/jira/browse/NETBEANS-5143.