buildnumber-maven-plugin属性$ {buildNumber}的可见性 [英] Visibility of buildnumber-maven-plugin property ${buildNumber}

查看:173
本文介绍了buildnumber-maven-plugin属性$ {buildNumber}的可见性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 buildnumber-maven-plugin 将SCM内部版本号附加到WAR工件名称,然后使用 tomcat7-maven-plugin 进行部署,但部署在不包含内部版本号的上下文路径中.因此,我正在创建 foo-r1234.war ,其中foo是我的项目,而1234是Subversion中的修订号,但我想将其部署在Tomcat上下文 foo 中.

我得到了能反映出内部版本号的信息,但是问题是Tomcat插件看不到内部编号所分配的${buildNumber}属性:

<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>

我知道

[错误]无法在项目foo上执行目标org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy(default-cli):无法找到War文件:/my/path/target/foo- r $ {buildNumber} .war-> [帮助1] [错误]

这表示tomcat插件看不到$ {buildNumber}.我如何使其可见才能将foo-r $ {buildNumber} .war部署到Tomcat中的上下文foo?

相关:

如何部署使用Maven tomcat插件以自动的内部版本号与tomcat进行战争

在部署目标期间未设置的时间戳和buildNumber属性

解决方案

在配置中添加构建最终名称 /${project.build.finalName}

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

解决方案

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

这篇关于buildnumber-maven-plugin属性$ {buildNumber}的可见性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆