Wildfly 15 wildfly-maven-plugin

时间:2019-02-13 21:29:53

标签: wildfly wildfly-maven-plugin

我们计划从Wildfly 8.2.1迁移到Wildfly15。但是,执行Wildfly Maven插件时遇到错误。抱怨

  

意外元素'{urn:jboss:cli:3.4} jboss-cli'

  

jboss-cli.xml:在[row,col]处出现ParseError:[6,38]

这是错误:

[ERROR] Failed to execute goal org.wildfly.plugins:wildfly-maven-plugin:2.0.0.Final:execute-commands (default-cli) on project jboss-system-properties: Execution default-cli of goal org.wildfly.plugins:wildfly-maven-plugin:2.0.0.Final:execute-commands failed: Failed to initialize CLI context: Failed to parse C:\server\wildfly-15.0.1.Final\bin\jboss-cli.xml: ParseError at [row,col]:[6,38]
[ERROR] Message: Unexpected element '{urn:jboss:cli:3.4}jboss-cli'
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.wildfly.plugins:wildfly-maven-plugin:2.0.0.Final:execute-commands (default-cli) on project jboss-system-properties: Execution default-cli of goal org.wildfly.plugins:wildfly-maven-plugin:2.0.0.Final:execute-commands failed: Failed to initialize CLI context
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
...
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal org.wildfly.plugins:wildfly-maven-plugin:2.0.0.Final:execute-commands failed: Failed to initialize CLI context
        ... 20 more
Caused by: java.lang.IllegalStateException: Failed to initialize CLI context
        ... 21 more
Caused by: org.jboss.as.cli.CliInitializationException: Failed to parse C:\server\wildfly-15.0.1.Final\bin\jboss-cli.xml
        ... 24 more
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[6,38]
Message: Unexpected element '{urn:jboss:cli:3.4}jboss-cli'
        at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:120)
        at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:76)
        at org.jboss.as.cli.impl.CliConfigImpl.parse(CliConfigImpl.java:174)
        ... 29 more

这是我们简单的pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <groupId>com.xyz.jboss.config.test</groupId>
   <artifactId>jboss-system-properties</artifactId>
   <version>0-SNAPSHOT</version>
   <name>jboss-system-properties</name>
   <url>http://maven.apache.org</url>
   <build>
      <plugins>
         <plugin>
            <groupId>org.wildfly.plugins</groupId>
            <artifactId>wildfly-maven-plugin</artifactId>
            <version>2.0.0.Final</version>
            <configuration>
               <commands>
                  <command>/system-property=test-key:add(value=test-val)</command>
               </commands>
            </configuration>
         </plugin>
      </plugins>
   </build>
</project>

这是我们的执行方式:mvn wildfly:execute-commands -X -e

1 个答案:

答案 0 :(得分:1)

我能够解决它。在<wildfly dir>\bin\jboss-cli.xml中,我将xmlns urn版本从3.4降级为3.3:

<jboss-cli xmlns="urn:jboss:cli:3.3">