2014-05-21 37 views
0

我有一个J2EE webapp,但是当我尝试更新web.xml中的display-name时,maven install会失败, [ERROR] <display-name> MUST NOT change between versions (was: abc xyz; now: abc-xyz).
有反正我可以做这个改变吗?如何在java maven项目中更新显示名称

- 谢谢。

回答

1

您可以使用下面的插件来更改显示名称

<plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-war-plugin</artifactId> 
      <version>2.4</version> 
      <configuration> 
       <webResources> 
        <resource> 
         <directory>src/main/webapp/WEB-INF/</directory> 
         <targetPath>WEB-INF</targetPath> 
         <includes> 
          <include>web.xml</include> 
         </includes> 
         <filtering>true</filtering> 
        </resource> 
       </webResources> 


    </configuration> 
</plugin> 

在pom.xml中

<properties> 
    <kp.version>1.0.0.1</kp.version> 
</properties> 

添加属性在web.xml中显示名称添加一个占位符,如下

<display-name>KPWS-${kp.version}</display-name> 
+0

仍然是同样的错误。 – james2611nov

+0

更新与您的pom.xml –

+0

为我工作的问题,谢谢。 – Hamid