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