maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From motes motes <mort.mo...@gmail.com>
Subject Common build jobs for sub modules should not be executed in parent
Date Wed, 02 Nov 2011 22:01:07 GMT
I have the following project structure:

parent
  |-> childA
  |-> childB

Is it possible to put a build task/plugin in the parent which is
common for childA and childB but should not be applied to the parent?

Eg.:

In childA and childB I have some identical build tasks using eg.
maven-antrun-plugin, maven-resources-plugin etc. and I would like to
eliminate this duplication.

I have tried to move these identical build tasks to the build scope in
the parent pom like:

<build>
...
			<plugin>
				<artifactId>maven-resources-plugin</artifactId>
				<configuration>
					<nonFilteredFileExtensions>
						<nonFilteredFileExtension>ico</nonFilteredFileExtension>
					</nonFilteredFileExtensions>
				</configuration>
				<executions>
					<execution>
						<id>copy-resources</id>
						<phase>generate-resources</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<outputDirectory>${data.basedir}</outputDirectory>
							<resources>
								<resource>
									<directory>data</directory>
									<filtering>true</filtering>
								</resource>
							</resources>
						</configuration>
					</execution>
					<execution>
						<id>filter-spec-file</id>
						<phase>generate-resources</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<outputDirectory>${basedir}</outputDirectory>
							<resources>
								<resource>
							        <filtering>true</filtering>
							        <directory>${basedir}/unfiltered</directory>
							        <includes>
							          <include>**/*.dat</include>
							        </includes>								
								</resource>
							</resources>
						</configuration>
					</execution>
				</executions>
			</plugin>
...
</build>


but it fails since it first tries to run the build plugin on the
parent which does not make sense - since its only the child modules
that have the specified files/directories.

So are there any way to remove build duplication for sub modules and
put them in a simple pom parent?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message