簡體   English   中英

jboss-as maven插件:reg-ex的undeploy不起作用

[英]jboss-as maven plugin: undeploy by reg-ex does not work

我的耳文有版本。 例如,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>
...

遵循undeploy插件的源代碼將帶您到這里 那就是使用String.matches方法。 所以你需要的是:

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

其中myApp文字后跟.+ (任何一次或多次char), \\. (點文字)和ear文字

這篇文章有一些關於java正則表達式的好信息。

不知道你是否需要升級插件版本,因為我剛剛運行了最新的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>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM