问题
I would like to change the default HTTP port using the wildfly-maven-plugin to 8380. Usually, I can do that changing the offset, but this is not working, my changes are ignored and HTTP port continues on 8080.
I'm starting wildfly in the same maven project, because this is way more practical (download and start automatically). Just like that:
mvn wildfly:run -Dwildfly.version=10.1.0.Final
My project contains JAR, WAR and EAR. Classic structure.
As I understood from another SO questions, I need to put the plugin entry in each pom.xml that needs to be ignored, putting <skip>true</skip>
in pom.xml of the: root, WAR and JAR. Just like that:
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.2.1.Final</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
If I not skip this guys, the Wildfly try to deploy the JAR/WAR/Root, what is not my objective. I would like to deploy only the EAR.
To do that, I use the <skip>false</skip>
only for pom.xml of the EAR:
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.2.1.Final</version>
<configuration>
<skip>false</skip>
</configuration>
</plugin>
The localhost:8080/app/
works well after that.
But if I try to change the offset or http port, nothing different happens. This is some of the args that I already try on <configuration/>
without success:
<server-args>
<server-arg>-Djboss.socket.binding.port-offset=300</server-arg>
</server-args>
<jvmArgs>-Djboss.socket.binding.port-offset=300</jvmArgs>
<jvmArgs>-Djboss.http.port=8380</jvmArgs>
The change that have some effect was:
<serverConfig>standalone.xml</serverConfig>
<server-args>
<server-arg>-Djboss.socket.binding.port-offset=300</server-arg>
</server-args>
<filename>${project.build.finalName}.ear</filename>
This also have changed the port (jvmArgs
is deprecated):
<javaOpts>-Djboss.socket.binding.port-offset=300</javaOpts>
But in both cases the EAR application is not deployed...
Any idea? Thanks!
回答1:
Finally, I found the solution.
The jvmArgs is deprecated. I used javaOpts:
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.2.1.Final</version>
<configuration>
<skip>false</skip>
<javaOpts>-Djboss.http.port=8380</javaOpts>
<filename>${project.build.finalName}.ear</filename>
</configuration>
</plugin>
Works!
You can use too:
<javaOpts>
<javaOpt>-agentlib:jdwp=transport=dt_socket,address=9087,server=y,suspend=n</javaOpt>
<javaOpt>-Djboss.http.port=8380</javaOpt>
</javaOpts>
To use more than one option for the JVM. In this example above I'm showing how to include a parameter to debug the Wildfly using the maven plugin.
But it's still a mistery why the EAR is not deployed when I use the offset configuration.
回答2:
try not skipping the configuration :D
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.2.1.Final</version>
<configuration>
<port>8380</port>
</configuration>
</plugin>
来源:https://stackoverflow.com/questions/47329021/change-http-port-in-wildfly-maven-plugin