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

我的梦境 提交于 2019-12-11 03:25:09

问题


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:


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



来源:https://stackoverflow.com/questions/47801759/visibility-of-buildnumber-maven-plugin-property-buildnumber

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!