Maven - MultiModule - Properties do Parent Pom

1 resposta
Rafael_Karamazov

no meu parent pom tenho

3.0.5.RELEASE 2.0.8 2.0.3.RELEASE 1.9.0 4.10 UTF-8

e no meu pom do filho , tenho algo como

org.mockito mockito-all ${org.mockito.version}

A pergunta é : como referenciar a propriedade do pai ?
Olhei no googliss, mas não vi uma solução que funcione.

vlw

1 Resposta

L
Talvez isso te ajude:
<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/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>br.net.woodstock.jee6web</groupId>
	<artifactId>jee6-web-parent</artifactId>
	<packaging>pom</packaging>
	<version>1.0</version>
	<name>JEE6 Application</name>
	<url>http://woodstock.net.br</url>

	<properties>
		<!-- Maven -->
		<project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>
		<!-- Java -->
		<ear.version>6</ear.version>
		<java.version>1.6</java.version>
		<!-- Test -->
		<test />
		<!-- Libs -->
		<jee.version>6.0</jee.version>
		<junit.version>3.8.2</junit.version>
		<richfaces.version>4.1.0.Final</richfaces.version>
		<!-- Plugins -->
		<plugin.compiler.version>2.3.2</plugin.compiler.version>
		<plugin.jar.version>2.3.2</plugin.jar.version>
		<plugin.resources.version>2.4.3</plugin.resources.version>
		<plugin.surefire.version>2.6</plugin.surefire.version>
		<plugin.war.version>2.1.1</plugin.war.version>
	</properties>

	<modules>
		<module>jee6-web-app</module>
		<module>jee6-web-components</module>
		<module>jee6-web-resources</module>
	</modules>

	<build>
		<defaultGoal>package</defaultGoal>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>${plugin.compiler.version}</version>
				<configuration>
					<source>${java.version}</source>
					<target>${java.version}</target>
					<encoding>${project.build.sourceEncoding}</encoding>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
				<version>${plugin.resources.version}</version>
				<configuration>
					<encoding>${project.build.sourceEncoding}</encoding>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<version>${plugin.surefire.version}</version>
				<configuration>
					<failIfNoTests>false</failIfNoTests>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>javax</groupId>
				<artifactId>javaee-api</artifactId>
				<version>${jee.version}</version>
				<scope>provided</scope>
			</dependency>
			<dependency>
				<groupId>javax</groupId>
				<artifactId>javaee-endorsed-api</artifactId>
				<version>${jee.version}</version>
				<scope>provided</scope>
			</dependency>
			<dependency>
				<groupId>javax</groupId>
				<artifactId>javaee-web-api</artifactId>
				<version>${jee.version}</version>
				<scope>provided</scope>
			</dependency>
			<dependency>
				<groupId>junit</groupId>
				<artifactId>junit</artifactId>
				<version>${junit.version}</version>
			</dependency>
			<dependency>
                <groupId>org.richfaces</groupId>
                <artifactId>richfaces-bom</artifactId>
                <version>${richfaces.version}</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
		</dependencies>
	</dependencyManagement>
</project>
<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>
	<artifactId>jee6-web-app</artifactId>
	<packaging>war</packaging>
	<parent>
		<relativePath>../</relativePath>
		<groupId>br.net.woodstock.jee6web</groupId>
		<artifactId>jee6-web-parent</artifactId>
		<version>1.0</version>
	</parent>
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<version>${plugin.war.version}</version><!-- Isso eh o que vc quer -->
				<configuration>
					<archive>
						<manifestEntries>
							<Dependencies>javax.faces.api, com.sun.jsf-impl</Dependencies>
						</manifestEntries>
					</archive>
				</configuration>
			</plugin>
		</plugins>
	</build>
	<dependencies>
		<dependency>
			<groupId>br.net.woodstock.jee6web</groupId>
			<artifactId>jee6-web-components</artifactId>
			<version>${project.version}</version>
			<scope>compile</scope>
		</dependency>
		<dependency>
			<groupId>br.net.woodstock.jee6web</groupId>
			<artifactId>jee6-web-resources</artifactId>
			<version>${project.version}</version>
			<scope>compile</scope>
		</dependency>
		<dependency>
			<groupId>javax</groupId>
			<artifactId>javaee-web-api</artifactId>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.richfaces.core</groupId>
			<artifactId>richfaces-core-impl</artifactId>
			<scope>compile</scope>
		</dependency>
		<dependency>
			<groupId>org.richfaces.ui</groupId>
			<artifactId>richfaces-components-ui</artifactId>
			<scope>compile</scope>
		</dependency>
	</dependencies>
</project>
Criado 3 de fevereiro de 2012
Ultima resposta 3 de fev. de 2012
Respostas 1
Participantes 2