Visibility of buildnumber-maven-plugin property ${buildNumber}

968 views Asked by At

I am trying to use buildnumber-maven-plugin to append the SCM build number to the WAR artifact name and then use tomcat7-maven-plugin to deploy it but in a context path that doesn't include the build number. So I am making foo-r1234.war where foo is my project and 1234 is the revision number in Subversion but I want to deploy it in a Tomcat context foo.

I got the war generation to reflect the build number but the problem is that the Tomcat plugin doesn't see the ${buildNumber} property assigned by the buildnumber plugin:

<finalName>foo-r${buildNumber}</finalName>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.4</version>
    <executions>
        <execution>
            <id>create-buildno</id>
            <phase>validate</phase>
            <goals>
                <goal>create</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <doCheck>false</doCheck>
        <doUpdate>false</doUpdate>
    </configuration>
</plugin>
...
<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <configuration>
        <url>http://localhost:8080/manager/text</url>
        <path>/foo</path>
    <warFile>${project.build.directory}/${project.build.finalName}.war</warFile>
    </configuration>
</plugin>

I get

[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project foo: Cannot find war file: /my/path/target/foo-r${buildNumber}.war -> [Help 1] [ERROR]

Which indicates the tomcat plugin doesn't see ${buildNumber}. How can I make it visible in order to deploy foo-r${buildNumber}.war to a context foo in Tomcat?

RELATED:

How to deploy war with automatic buildnumber to tomcat using maven tomcat plugin

timestamp and buildNumber properties not set during deploy goal

1

There are 1 answers

0
tangobee On

Add build final name in configuration /${project.build.finalName}