我正在尝试使用 wildfly-swarmproject-stages.yml
src/main/resources/META-INF/persistence.xml
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
version="2.1">
<persistence-unit name="somePU" transaction-type="JTA">
<jta-data-source>someDS</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="javax.persistence.validation.mode" value="CALLBACK" />
</properties>
</persistence-unit>
</persistence>
src/main/resources/project-stages.yml
project:
stage: default
---
project:
stage: development
logger:
level: DEBUG
swarm:
jdbc:
driver: org.apache.derby.jdbc.EmbeddedDriver
ds:
name: someDS
connection:
url: jdbc:derby:memory:someDB;create=true
port:
offset: 200
---
project:
stage: integration
---
project:
stage: staging
---
project:
stage: production
mvn -Dswarm.project.stage=development -jar target/some-server-swarm.jar
2017-01-07 18:09:48,782 ERROR [stderr] (main) java.lang.reflect.InvocationTargetException
2017-01-07 18:09:48,782 ERROR [stderr] (main) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2017-01-07 18:09:48,782 ERROR [stderr] (main) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2017-01-07 18:09:48,783 ERROR [stderr] (main) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2017-01-07 18:09:48,783 ERROR [stderr] (main) at java.lang.reflect.Method.invoke(Method.java:498)
2017-01-07 18:09:48,783 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.MainInvoker.invoke(MainInvoker.java:37)
2017-01-07 18:09:48,783 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.Main.run(Main.java:44)
2017-01-07 18:09:48,783 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.Main.main(Main.java:35)
2017-01-07 18:09:48,784 ERROR [stderr] (main) Caused by: org.wildfly.swarm.container.DeploymentException: WFSWARM0007: Deployment failed: {"WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.jboss.datasources.someDS"],"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"some-server.war#somePU\".__FIRST_PHASE__ is missing [jboss.naming.context.java.jboss.datasources.someDS]","jboss.persistenceunit.\"some-server.war#somePU\" is missing [jboss.naming.context.java.jboss.datasources.someDS]"]}
2017-01-07 18:09:48,784 ERROR [stderr] (main) at org.wildfly.swarm.container.runtime.RuntimeDeployer.deploy(RuntimeDeployer.java:280)
2017-01-07 18:09:48,784 ERROR [stderr] (main) at org.wildfly.swarm.container.runtime.RuntimeDeployer.deploy(RuntimeDeployer.java:95)
2017-01-07 18:09:48,784 ERROR [stderr] (main) at org.wildfly.swarm.Swarm.deploy(Swarm.java:475)
2017-01-07 18:09:48,784 ERROR [stderr] (main) at org.wildfly.swarm.Swarm.main(Swarm.java:612)
2017-01-07 18:09:48,784 ERROR [stderr] (main) ... 7 more
2017-01-07 18:09:48,784 ERROR [stderr] (main) Exception in thread "main" java.lang.reflect.InvocationTargetException
2017-01-07 18:09:48,785 ERROR [stderr] (main) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2017-01-07 18:09:48,785 ERROR [stderr] (main) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2017-01-07 18:09:48,785 ERROR [stderr] (main) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2017-01-07 18:09:48,785 ERROR [stderr] (main) at java.lang.reflect.Method.invoke(Method.java:498)
2017-01-07 18:09:48,785 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.MainInvoker.invoke(MainInvoker.java:37)
2017-01-07 18:09:48,785 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.Main.run(Main.java:44)
2017-01-07 18:09:48,785 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.Main.main(Main.java:35)
2017-01-07 18:09:48,785 ERROR [stderr] (main) Caused by: org.wildfly.swarm.container.DeploymentException: WFSWARM0007: Deployment failed: {"WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.jboss.datasources.someDS"],"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"some-server.war#somePU\".__FIRST_PHASE__ is missing [jboss.naming.context.java.jboss.datasources.someDS]","jboss.persistenceunit.\"some-server.war#somePU\" is missing [jboss.naming.context.java.jboss.datasources.someDS]"]}
2017-01-07 18:09:48,785 ERROR [stderr] (main) at org.wildfly.swarm.container.runtime.RuntimeDeployer.deploy(RuntimeDeployer.java:280)
2017-01-07 18:09:48,786 ERROR [stderr] (main) at org.wildfly.swarm.container.runtime.RuntimeDeployer.deploy(RuntimeDeployer.java:95)
2017-01-07 18:09:48,786 ERROR [stderr] (main) at org.wildfly.swarm.Swarm.deploy(Swarm.java:475)
2017-01-07 18:09:48,786 ERROR [stderr] (main) at org.wildfly.swarm.Swarm.main(Swarm.java:612)
2017-01-07 18:09:48,786 ERROR [stderr] (main) ... 7 more