已经有一个具有相同运行时名称的部署

there's already a deployment with the same runtime name

我正在尝试使用 maven wildfly 插件将我的 .war 部署到我的应用程序服务器。

所以我在 IntelliJ 中配置了这个,它为我部署了 war,但我想使用 maven,所以我也可以用 jenkins 部署。

当我调用 mvn wildfly:deploy 时,出现以下错误:

[ERROR] Failed to execute goal org.wildfly.plugins:wildfly-maven-plugin:1.2.1.Final:deploy (default-cli) on project Kwetter: Failed to execute goal deploy: {"WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-1" => "WFLYSRV0205: There is already a deployment called Kwetter.war with the same runtime name Kwetter.war"}}

所以我去了 jboss-cli.bat 并尝试删除未部署的 .war。 但是当我去那里并调用 undeploy Kwetter.war 我得到:

Undeploy failed: {"WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-1" => "WFLYCTL0216: Management resource '[(\"deployment\" => \"Kwetter.war\")]' not found"}}

当我尝试取消部署 *.war 我得到同样的错误,似乎没有部署任何东西?

我还尝试在我的 pom.xml 中添加 force = true 这样它会覆盖已经存在的 .war 但这只是给了我相同的错误。

我收录了我的 pom.xml 以供参考:

<repositories>
    <repository>
        <id>maven2-repository.java.net</id>
        <name>Java.net Repository for Maven</name>
        <url>http://download.java.net/maven/2/</url>
        <layout>default</layout>
    </repository>
</repositories>

<properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <failOnMissingWebXml>false</failOnMissingWebXml>
</properties>

<build>
    <finalName>Kwetter</finalName>
    <plugins>
        <plugin>
            <groupId>org.wildfly.plugins</groupId>
            <artifactId>wildfly-maven-plugin</artifactId>
            <version>1.2.1.Final</version>
            <configuration>
                <!--change management console port-->
                <port>9990</port>
                <!--redeploy if exists-->
                <force>true</force>
                <username>newadmin</username>
                <password>newadmin</password>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.19.1</version>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.5</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>

<profiles>
    <profile>
        <!-- The profile to execute wildfly managed integration tests.
        Other profiles similar to this could be created for other container adapters-->
        <id>wildfly</id>
        <!-- the dependencies for Wildfly  -->
        <dependencies>
            <dependency>
                <groupId>org.wildfly</groupId>
                <artifactId>wildfly-arquillian-container-managed</artifactId>
                <version>8.2.1.Final</version>
            </dependency>

            <dependency>
                <groupId>org.wildfly</groupId>
                <artifactId>wildfly-embedded</artifactId>
                <version>8.2.1.Final</version>
            </dependency>

        </dependencies>
        <build>
            <testResources>
                <testResource>
                    <directory>src/test/resources</directory>
                </testResource>
                <testResource>
                    <directory>src/test/resources-jbossas-managed</directory>
                </testResource>
            </testResources>
        </build>
    </profile>
</profiles>

  <!-- https://mvnrepository.com/artifact/javax.faces/jsf-api -->
  <dependency>
      <groupId>javax.faces</groupId>
      <artifactId>jsf-api</artifactId>
      <version>2.1</version>
      <scope>provided</scope>
  </dependency>

  <!-- https://mvnrepository.com/artifact/org.mockito/mockito-all -->
  <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-all</artifactId>
      <version>1.10.19</version>
      <scope>test</scope>
  </dependency>

  <!-- https://mvnrepository.com/artifact/org.wildfly/wildfly-dist -->
  <dependency>
      <groupId>org.wildfly</groupId>
      <artifactId>wildfly-dist</artifactId>
      <version>11.0.0.Final</version>
  </dependency>

  <dependency>
      <groupId>org.jboss.arquillian.junit</groupId>
      <artifactId>arquillian-junit-container</artifactId>
      <version>1.3.0.Final</version>
  </dependency>

<dependency>
    <groupId>org.wildfly</groupId>
    <artifactId>wildfly-arquillian-container-managed</artifactId>
    <version>8.2.1.Final</version>
</dependency>

<dependency>
    <groupId>org.wildfly</groupId>
    <artifactId>wildfly-embedded</artifactId>
    <version>8.2.1.Final</version>
</dependency>

  <!--Junit-->
  <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
  </dependency>

  <dependency>
      <groupId>org.jboss.spec</groupId>
      <artifactId>jboss-javaee-7.0</artifactId>
      <version>1.0.3.Final</version>
      <type>pom</type>
      <scope>provided</scope>
  </dependency>

  <!-- https://mvnrepository.com/artifact/javax/javaee-api -->
  <dependency>
      <groupId>javax</groupId>
      <artifactId>javaee-api</artifactId>
      <version>7.0</version>
      <scope>provided</scope>
  </dependency>

  <!-- https://mvnrepository.com/artifact/javax.persistence/persistence-api -->
  <dependency>
      <groupId>javax.persistence</groupId>
      <artifactId>persistence-api</artifactId>
      <version>1.0.2</version>
  </dependency>

  <!-- https://mvnrepository.com/artifact/javax.ws.rs/javax.ws.rs-api -->
  <dependency>
      <groupId>javax.ws.rs</groupId>
      <artifactId>javax.ws.rs-api</artifactId>
      <version>2.1</version>
  </dependency>
  <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-annotations</artifactId>
      <version>2.8.9</version>
  </dependency>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.jboss.arquillian</groupId>
            <artifactId>arquillian-bom</artifactId>
            <version>1.3.0.Final</version>
            <scope>import</scope>
            <type>pom</type>
        </dependency>
    </dependencies>
</dependencyManagement>

我不是 100% 确定到底是什么问题。但是我能够找到在 wildfly 的管理控制台中处于活动状态的部署。 (为什么它没有出现在 CLI 中,我不知道)。当我使用 UI 删除那里的部署时,我能够 运行 mvn deploy 命令,并部署 .war。此外,当我再次 运行 mvn deploy 命令时,它会删除旧的 .war 并将新构建的放在那里。

查看此主题以供参考:

我最近遇到了这个问题。我发现 JBoss 安装目录下的 standalone.xml 文件有一个存档的部署标签。一旦我删除它就解决了问题。

我找到问题所在了。 我 运行 来自 inteiij 的应用程序,有一段时间我在部署应用程序时遇到错误。

  1. 停止疯狂
  2. 转到sandalone.xml
  3. 删除部署部分
  <deployments>
    <deployment name="xxx.war" runtime-name="xxx.war">
    <fs-archive path="...\xxx.war"/>
    </deployment>
    </deployments>