Wildfly Maven plugin + hot deployment

2019-09-09 03:26发布

问题:

I have a Java Spring application, configured in Eclipse Mars and I am running Wildfly 9 from with in Eclipse. I am using the wildfly-maven-plugin to deploy to server.

These are the steps I follow:

Start the server from eclipse and do Maven build which also deploys the application to server. I can see whole lot of logs on server of "successful deployment"and I can access my application in browser. It creates a folder under "/standalone/data/content" but no war or exploded WAR under "standalone/deployments"

If I change some code and save it in eclipse, (I have checked Automatically publish check box and build on save), The sever logs says: Replaced deployment "myApp.war" with deployment "myApp.war" Content removed from location "standalone\data\content..."

And I see the prev folder created during step 1 is removed and myApp.war is added to deployment folder. But now I can not access my application in browser.

auto-deploy-exploded="true"

That is in the section of standalone.xml.

回答1:

The wildfly-maven-plugin deploys applications using management operations. It doesn't deploy any exploded content only the archive. In other words you'd need to recreate the deployment archive before you redeploy otherwise changes won't be seen.

As @ozOli says it's probably best to use JBoss Tools.

There is an open issue to allow exploded content to be deployed. This is currently suggested only for the run goal, but it could likely be expanded to deploy exploded content as well. I think deploying exploded content works.

In general though the issue with "hot deployments" is source needs to be recompiled and then redeployed. The redploy is key as annotations and such need to be rescanned.



回答2:

For Eclipse you can use the JBoss Tools plugins: http://tools.jboss.org/