4

My ear files have version in them. For example, myApp-1.0.1.ear or myApp-1.0.2.ear. I'm trying to undeploy by regex(cause I don't know what the current version is), and then deploy.

However, undeploy by regex is not working for me. I'm looking for 'myApp-*.ear', however it doesn't work unless the version in pom matches the version of current deployment...

what am I doing wrong?

Here's my 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>
...
user2793390
  • 691
  • 6
  • 26

2 Answers2

1

Following the source code of the undeploy plugin will bring you here. That use String.matches method. So what you need is something like:

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

Where myApp literal is followed by .+ (any char one or more times), \. (dot literal) and ear literal

This post have some good information about java regex.

Community
  • 1
  • 1
fhofmann
  • 847
  • 7
  • 15
0

Not sure if you need to upgrade the plugin version as i just ran through latest jboss docs and found below configuration which is slightly different then yours.

  <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>
Indra Uprade
  • 765
  • 4
  • 12