【问题标题】:jboss-as maven plugin: undeploy by reg-ex does not workjboss-as maven 插件:通过 reg-ex 取消部署不起作用
【发布时间】:2015-09-01 16:57:07
【问题描述】:

我的耳朵文件中有版本。例如,myApp-1.0.1.ear 或 myApp-1.0.2.ear。我正在尝试通过正则表达式取消部署(因为我不知道当前版本是什么),然后部署。

但是,通过正则表达式取消部署对我不起作用。我正在寻找“myApp-*.ear”,但是除非 pom 中的版本与当前部署的版本匹配,否则它不起作用...

我做错了什么?

这是我的 pom.xml

...
<version>1.0.0</version>
...
<plugin>
    <groupId>org.jboss.as.plugins</groupId>
    <artifactId>jboss-as-maven-plugin</artifactId>
    <version>7.4.Final</version>
    <executions>
        <execution>
          <phase>clean</phase>
          <goals>
              <goal>undeploy</goal>
          </goals>
          <configuration>
              <match-pattern>myApp-*.ear</match-pattern>
              <ignoreMissingDeployment>true</ignoreMissingDeployment>
              <matchPatternStrategy>fail</matchPatternStrategy>
          </configuration>
        </execution>
        <execution>
            <id>install-application</id>
            <phase>install</phase>
            <goals>
                <goal>deploy</goal>
            </goals>
        </execution>
    </executions>
...

【问题讨论】:

  • 我觉得你需要myApp-.*\.ear
  • @JamesR.Perkins 试过了。它没有用。
  • 我也有同样的问题。
  • 我在这里为维护者提交了一个错误issues.jboss.org/projects/WFMP/issues/…
  • 您是否考虑过在不包含版本的部署名称下使用 --force 选项部署应用程序,以便新版本替换旧版本?

标签: java maven jboss7.x


【解决方案1】:

跟随 undeploy 插件的源代码将带给你here。即使用String.matches 方法。所以你需要的是这样的:

      <configuration>
          <match-pattern>myApp.+\.ear</match-pattern>
          <ignoreMissingDeployment>true</ignoreMissingDeployment>
          <matchPatternStrategy>fail</matchPatternStrategy>
      </configuration>

myApp 文字后跟 .+(任何字符一次或多次)、\.(点文字)和 ear 文字

This post 有一些关于 java 的好信息正则表达式。

【讨论】:

    【解决方案2】:

    不确定是否需要升级插件版本,因为我刚刚浏览了最新的 jboss 文档,发现下面的配置与你的略有不同。

      <plugin>
          <groupId>org.jboss.as.plugins</groupId>
          <artifactId>jboss-as-maven-plugin</artifactId>
          <version>7.8.Final</version>
          <executions>
              <execution>
                  <phase>clean</phase>
                  <goals>
                      <goal>undeploy-artifact</goal>
                  </goals>
                  <configuration>
                      <groupId>xxxxx</groupId>
                      <artifactId>xxxxx</artifactId>
                      <version>x.x.x</version>
                      <type>ear</type>
                      <name>xxxxx.ear</name>
                      <match-pattern>myApp-.*</match-pattern>
                  </configuration>
              </execution>
          </executions>
      </plugin>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-05-11
      • 2017-07-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-03
      相关资源
      最近更新 更多