【发布时间】: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