我是maven-release-plugin的新手,我第一次尝试发布我的java web应用程序。现在我可以标记应用程序,但在此过程中我遇到了一些问题。
我试着以更好的方式向你解释。我正在从事模块化项目:
|-- parent
|-- model
pom.xml
|-- services
pom.xml
|-- rest
pom.xml
|-- web-app
pom.xml
pom.xml
这是父母标记的pom:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>it.myCompany</groupId>
<artifactId>myApp</artifactId>
<version>2.1.0</version>
<packaging>pom</packaging>
<modules>
<module>model</module>
<module>services</module>
<module>rest</module>
<module>web-app</module>
</modules>
<scm>
<connection>scm:svn:svn://192.168.0.9/home/svn/myFolder/tags/myApp2.1.0/</connection>
<developerConnection>scm:svn:svn://192.168.0.9/home/svn/myFolder/tags/myApp2.1.0/</developerConnection>
</scm>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.2.2</version>
<dependencies>
<dependency>
<groupId>com.google.code.maven-scm-provider-svnjava</groupId>
<artifactId>maven-scm-provider-svnjava</artifactId>
<version>2.1.1</version>
</dependency>
</dependencies>
<configuration>
<providerImplementations>
<svn>javasvn</svn>
</providerImplementations>
<goals>tomcat7:deploy</goals>
</configuration>
</plugin>
<!-- To launch embded tomcat server -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<url>http://192.168.0.21:8081/manager/text</url>
<server>tomcat-devel</server>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>Development</id>
<properties>
<db.driverClass>oracle.jdbc.driver.OracleDriver</db.driverClass>
<db.connectionURL>jdbc:oracle:thin:@192.168.0.12:1521:development</db.connectionURL>
<db.username>myUser</db.username>
<db.password>MyPass</db.password>
<maven.test.skip>true</maven.test.skip>
<maven.javadoc.skip>true</maven.javadoc.skip>
</properties>
</profile>
<profile>
<id>Customer1</id>
<properties>
<db.driverClass>oracle.jdbc.driver.OracleDriver</db.driverClass>
<db.connectionURL>jdbc:oracle:thin:@192.168.0.13:1521:Customer1</db.connectionURL>
<db.username>myUser</db.username>
<db.password>MyPass</db.password>
<maven.test.skip>true</maven.test.skip>
<maven.javadoc.skip>true</maven.javadoc.skip>
</properties>
</profile>
<profile>
<id>Customer2</id>
<properties>
<db.driverClass>oracle.jdbc.driver.OracleDriver</db.driverClass>
<db.connectionURL>jdbc:oracle:thin:@192.168.0.14:1521:Customer2</db.connectionURL>
<db.username>myUser</db.username>
<db.password>MyPass</db.password>
<maven.test.skip>true</maven.test.skip>
<maven.javadoc.skip>true</maven.javadoc.skip>
</properties>
</profile>
</profiles>
</project>
相反,这是模型项目
中包含的persistence.xml部分<properties>
<property name="javax.persistence.jdbc.driver" value="${db.driverClass}" />
<property name="javax.persistence.jdbc.url" value="${db.connectionURL}" />
<property name="javax.persistence.jdbc.user" value="${db.username}" />
<property name="javax.persistence.jdbc.password" value="${db.password}" />
</properties>
现在,因为我有一些安装myApp的客户端,所以我尝试执行
mvn release:执行-P Customer1
但是这不起作用,构建过程无法替换标签$ {db.driverClass},$ {db.connectionURL},$ {db.username},$ {db.password}并包含相应的值在Customer1个人资料中。
问题也出现了tomcat,因为我必须在不同的tomcat上安装myApp(Customer1在192.168.0.20上有自己的tomcat,而Customer2在192.168.0.21上有自己的tomcat)。
有什么建议吗? 我该如何解决?