我有一个Web应用程序并完成了:
配置pom以生成Manifest条目:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>timestamp-property</id>
<goals>
<goal>timestamp-property</goal>
</goals>
<configuration>
<name>current.time</name>
<pattern>yyyy-MM-dd HH:mm:ss Z</pattern>
<timeZone>GMT+0</timeZone>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<!-- Build an executable JAR -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addClasspath>true</addClasspath>
</manifest>
<manifestEntries>
<git-sha>${buildNumber}</git-sha>
<git-branch>${scmBranch}</git-branch>
<build-date>${current.time}</build-date>
</manifestEntries>
</archive>
</configuration>
</plugin>
它可以从命令行运行,而Manifest具有所需的条目。像这样的东西:
git-branch: master
build-date: 2016-05-30 07:19:43 +0000
Implementation-Version: 1.0.0-SNAPSHOT
Archiver-Version: Plexus Archiver
git-sha: 7c248cbc66303e4e2574112049deef03a03856cd
当我在IDEA中选择Maven生命周期'clean'和'install'并运行它们时,Manifest也会正确生成。
但是当我尝试通过运行配置(使用Tomcat配置)运行Web应用程序时,Manifest包含诸如
之类的变量git-branch: ${scmBranch}
build-date: ${current.time}
Implementation-Version: 1.0.0-SNAPSHOT
git-sha:
我在App中使用这些条目。我总是可以使用命令行,但这使得调试变得困难。
似乎IDEA Make没有使用Maven。有没有办法让IDEA Make运行Maven安装或我能做的其他事情?