在Wildfly Maven插件中更改HTTP端口 [英] Change http port in wildfly maven plugin

查看:244
本文介绍了在Wildfly Maven插件中更改HTTP端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 wildfly-maven-plugin 将默认的HTTP端口更改为8380.通常,我可以通过更改偏移量来做到这一点,但是

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.

我要在同一个Maven项目中启动wildfly,因为这更加实用(下载并自动启动).就是这样:

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

我的项目包含JAR,WAR和EAR.经典的结构.

My project contains JAR, WAR and EAR. Classic structure.

正如我从另一个SO问题中了解到的那样,我需要将插件条目放在每个需要忽略的pom.xml中,将<skip>true</skip>放在以下目录的pom.xml中:root,WAR和JAR.就是这样:

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>

如果我不跳过这个家伙,Wildfly会尝试部署JAR/WAR/Root,这不是我的目标.我只想部署EAR.

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.

为此,我仅将<skip>false</skip>用于EAR的pom.xml:

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>

localhost:8080/app/之后运行良好.

但是,如果我尝试更改偏移量或http端口,则不会发生任何不同的情况.这是我已经在<configuration/>上尝试过但未成功的一些args:

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>

生效的更改是:

<serverConfig>standalone.xml</serverConfig>
<server-args>
    <server-arg>-Djboss.socket.binding.port-offset=300</server-arg>
</server-args>
<filename>${project.build.finalName}.ear</filename>

这也更改了端口(jvmArgs

This also have changed the port (jvmArgs is deprecated):

<javaOpts>-Djboss.socket.binding.port-offset=300</javaOpts>

但是在两种情况下都没有部署EAR应用程序...

But in both cases the EAR application is not deployed...

有什么主意吗?谢谢!

推荐答案

最后,我找到了解决方案.

Finally, I found the solution.

已弃用 jvmArgs .我使用了javaOpts:

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>

有效!

您也可以使用:

<javaOpts>
    <javaOpt>-agentlib:jdwp=transport=dt_socket,address=9087,server=y,suspend=n</javaOpt>
    <javaOpt>-Djboss.http.port=8380</javaOpt>
</javaOpts>

为JVM使用多个选项.在上面的示例中,我演示了如何使用maven插件包含参数以调试Wildfly.

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.

但是,当我使用偏移配置时,为什么不部署EAR仍然是个谜.

But it's still a mistery why the EAR is not deployed when I use the offset configuration.

这篇关于在Wildfly Maven插件中更改HTTP端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆