maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alejandro.E...@miranda.com
Subject Re: Can I force a plugin to not run during parent pom execution phase?
Date Tue, 02 Apr 2013 19:41:35 GMT

A trick i use, provided the plugin has a configuration to skip a run, is
having something like this in the parent

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-assembly-plugin</artifactId>
	<version>2.4</version>
	<executions>
		<execution>
			<id>my-id</id>
			<phase>package</phase>
			<inherited>true</inherited>
			<configuration>
				<descriptorRefs>
					<descriptorRef>config</descriptorRef>
				</descriptorRefs>
				<appendAssemblyId>false</appendAssemblyId>
			</configuration>
			<goals>
				<goal>single</goal>

			</goals>
			</execution>
	</executions>
	<configuration>
		<skipAssembly>true</skipAssembly>
	</configuration>
	<inherited>false</inherited> <!-- so skip isn't inherited -->
</plugin>


So as you can see, inside execution i enable inheritance and outside
execution i configure the plugin to skip the run using the skipAssembly
configuration and disable inheritance


Notice that this still starts the plugin execution, but the run will end
very early when it detects it will be skipped. This might be a problem when
e.g. the plugin has a mandatory config argument that you define in the
children. In that case, the verification for the parameter will make the
build fail before you get to skip it


I know this is limited but maybe your plugin has such a configuration. or
if you wrote it yourself you can add it



If this is not useful, take a look at this. The answer was not useful to me
but the discussion is there anyway

http://stackoverflow.com/questions/1625492/execute-maven-plugin-goal-on-child-modules-but-not-on-parent




Alejandro Endo | Software Designer/Concepteur de logiciels




From:	laredotornado-3 <laredotornado@gmail.com>
To:	users@maven.apache.org,
Date:	02/04/2013 02:07 PM
Subject:	Can I force a plugin to not run during parent pom execution
            phase?



Hi,

I'm using Maven 3.0.3.  I've included this plugin in a profile in my parent
pom, however, when I run my parent pom, I don't want this to be executed as
part of the parent pom being built (I do want it executed for each of the
child modules).  How can I make this plugin not run during the parent
execution phase?

		 <modelVersion>4.0.0</modelVersion>
		 <groupId>org.mainco.subco</groupId>
		 <artifactId>subco</artifactId>
		 <version>12.0.0-SNAPSHOT</version>
		 <modules>
		 		 <module>moduleA</module>
		 		 <module>moduleB</module>
		 		 <module>moduleC</module>
		 		 <packaging>pom</packaging>

		 <profiles>
		 		 <profile>
		 		 		 ...
		 		 		 		 		 <plugin>

<groupId>org.liquibase</groupId>

<artifactId>liquibase-maven-plugin</artifactId>

<version>2.0.1</version>

<dependencies>

	 <dependency>

	 		 <groupId>mysql</groupId>

	 		 <artifactId>mysql-connector-java</artifactId>

	 		 <version>5.1.18</version>

	 </dependency>

</dependencies>

<executions>

	 <execution>

	 		 <id>build-database</id>

	 		 <phase>process-test-resources</phase>

	 		 <configuration>

	 		 		 <driver>com.mysql.jdbc.Driver</driver>


<url>jdbc:mysql://${test.mysql.db.host}:${test.mysql.db.port}/$
{test.mysql.db.sid}</url>

	 		 		 <username>${test.mysql.db.user}</username>

	 		 		 <password>$
{test.mysql.db.password}</password>


<changeLogFile>$
{project.build.directory}/db.changelog-master.xml</changeLogFile>


<promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>

	 		 </configuration>

	 		 <goals>

	 		 		 <goal>update</goal>

	 		 </goals>

	 </execution>

</executions>
		 		 		 		 		 </plugin>

Thanks, - Dave




--
View this message in context:
http://maven.40175.n5.nabble.com/Can-I-force-a-plugin-to-not-run-during-parent-pom-execution-phase-tp5752479.html

Sent from the Maven - Users mailing list archive at Nabble.com.

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


DISCLAIMER:

Privileged and/or Confidential information may be contained in this
message. If you are not the addressee of this message, you may not
copy, use or deliver this message to anyone. In such event, you
should destroy the message and kindly notify the sender by reply
e-mail. It is understood that opinions or conclusions that do not
relate to the official business of the company are neither given
nor endorsed by the company.

Thank You.


Mime
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message