【问题标题】:Configure Wildfly Naming subsytem on deploy with Maven plugin wildfly-maven-plugin使用 Maven 插件 wildfly-maven-plugin 在部署时配置 Wildfly 命名子系统
【发布时间】:2016-01-27 12:59:36
【问题描述】:

我想向命名子系统添加一个资源,以便我可以通过 @Resource 注释将它拉入我的 EJB。理想情况下,必须在构建时为该特定环境添加资源(一旦我得到这个工作,我将在 maven 中设置在 settings.xml 中设置的变量)。我目前正在使用wildfly-maven-plugin,但找不到在任何地方添加对字符串资源的 JNDI 引用的地方。当我运行 mvn wildfly:deploy 时它通常会失败:

[ERROR] Failed to execute goal org.wildfly.plugins:wildfly-maven-plugin:1.1.0.Alpha5:add-resource (add_jndi) on project Project: Could not execute goal add-resource. Reason: Operation failed: "JBAS014807: Management resource '[
[ERROR] (\"subsystem\" => \"naming\"),
[ERROR] (\"binding\" => \"java:global/Project/key\")
[ERROR] ]' not found"
[ERROR] -> [Help 1]

我的 pom.xml 如下所示:

...
<plugin>
    <groupId>org.wildfly.plugins</groupId>
    <artifactId>wildfly-maven-plugin</artifactId>
    <version>${wildfly-maven-plugin.version}</version>
    <inherited>false</inherited>
    <configuration>
        <skip>false</skip>
    </configuration>
    <executions>
        <execution>
            <id>add_jndi</id>
            <phase>package</phase>
            <goals>
                <goal>add-resource</goal>
            </goals>
            <configuration>
                <address>subsystem=naming,binding=java:global/Project/key,binding-type=simple</address>
                <resources>
                    <resource>
                        <properties>
                            <name>key</name>
                            <type>java.lang.String</type>
                            <value>value</value>
                        </properties>
                    </resource>
                </resources>
            </configuration>
        </execution>
    </executions>
</plugin>
...

这是可能的并记录在CLI for wildfly

我目前正在使用 Wildfly 8.2、Java JDK 8 和 Maven 3。

【问题讨论】:

    标签: java maven environment-variables wildfly-8


    【解决方案1】:

    可以将执行命令配置为运行 CLI 命令。 executeCommands 标签可以在插件配置中配置。例如,请访问this link

    【讨论】:

    • 谢谢。在插件扩展之前,这似乎是最好的破解。
    猜你喜欢
    • 2015-11-03
    • 2017-08-28
    • 1970-01-01
    • 2018-03-28
    • 1970-01-01
    • 2015-01-22
    • 1970-01-01
    • 2014-11-07
    • 2020-05-05
    相关资源
    最近更新 更多