You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Matthew Adams <ma...@matthewadams.me> on 2013/02/08 00:01:46 UTC

Problem reusing specific plugin executions with profiles

Background:
I have a layered architecture, built via a multimodule Maven project, and I
use profiles to activate which relational database (derby, mysql, or
sqlserver) & driver (derby, myssql, jtds, or msjdbc) is used for any given
build.  Obviously, the derby database uses the derby driver, mysql uses
mysql, but sqlserver can use either jtds or msjdbc (the Microsoft SQL Server
JDBC driver).

If the jtds or msjdbc profile is active, I want to add a database ping (that
is, connect & issue a "select 1") during the initialize phase to ensure that
the intended databases are available over the desired driver.

Vitals:
$ mvn --version
Apache Maven 3.0.4 (r1232337; 2012-01-17 02:44:56-0600)
Maven home: /Applications/springsource/apache-maven-3.0.4
Java version: 1.6.0_37, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.7.5", arch: "x86_64", family: "mac"

I have a parent pom that defines the following in its
project/build/pluginManagement section so that I can ping the database
server(s) that must be alive when the build runs.  The SQL command I'm
executing is simply "select 1", and the database
driver/url/username/password are all pretty straightforward.  Each execution
differs only by the database driver+url combo & the kind of database ("test"
or "seed"), so there are four permutations.

My intent is to use certain of these executions, activated by Maven
profiles, of course, in various child poms.

===== PARENT POM SNIPPET
<plugin>
	<groupId>org.codehaus.mojo</groupId>
	<artifactId>sql-maven-plugin</artifactId>
	<version>${app.sql-maven-plugin.version}</version>
	<dependencies>
		<dependency>
			<groupId>net.sourceforge.jtds</groupId>
			<artifactId>jtds</artifactId>
			<version>${app.jtds.version}</version>
		</dependency>
	</dependencies>
	<executions>
		<execution>
			<id>sqlserver-jtds-ping-test-db</id>
			<goals>
				<goal>execute</goal>
			</goals>
			<phase>initialize</phase>
			<configuration>
				<driver>${app.rdb.sqlserver-jtds.database.driver.name}</driver>
				<username>${app.rdb.sqlserver.test.database.username}</username>
				<password>${app.rdb.sqlserver.test.database.password}</password>
				<url>${app.rdb.sqlserver-jtds.test.database.url}</url>
				<sqlCommand>${app.rdb.sqlserver.ping.sql.command}</sqlCommand>
			</configuration>
		</execution>
		<execution>
			<id>sqlserver-jtds-ping-seed-db</id>
			<goals>
				<goal>execute</goal>
			</goals>
			<phase>initialize</phase>
			<configuration>
				<driver>${app.rdb.sqlserver-jtds.database.driver.name}</driver>
				<username>${app.rdb.sqlserver.seed.database.username}</username>
				<password>${app.rdb.sqlserver.seed.database.password}</password>
				<url>${app.rdb.sqlserver-jtds.seed.database.url}</url>
				<sqlCommand>${app.rdb.sqlserver.ping.sql.command}</sqlCommand>
			</configuration>
		</execution>
		<execution>
			<id>sqlserver-msjdbc-ping-test-db</id>
			<goals>
				<goal>execute</goal>
			</goals>
			<phase>initialize</phase>
			<configuration>
				<driver>${app.rdb.sqlserver-msjdbc.database.driver.name}</driver>
				<username>${app.rdb.sqlserver.test.database.username}</username>
				<password>${app.rdb.sqlserver.test.database.password}</password>
				<url>${app.rdb.sqlserver-msjdbc.test.database.url}</url>
				<sqlCommand>${app.rdb.sqlserver.ping.sql.command}</sqlCommand>
			</configuration>
		</execution>
		<execution>
			<id>sqlserver-msjdbc-ping-seed-db</id>
			<goals>
				<goal>execute</goal>
			</goals>
			<phase>initialize</phase>
			<configuration>
				<driver>${app.rdb.sqlserver-msjdbc.database.driver.name}</driver>
				<username>${app.rdb.sqlserver.seed.database.username}</username>
				<password>${app.rdb.sqlserver.seed.database.password}</password>
				<url>${app.rdb.sqlserver-msjdbc.seed.database.url}</url>
				<sqlCommand>${app.rdb.sqlserver.ping.sql.command}</sqlCommand>
			</configuration>
		</execution>
	</executions>
</plugin>
===== PARENT POM SNIPPET

So far, so good.  In a child pom, I have the following profiles, defined in
its project/profiles section.

===== CHILD POM SNIPPET
<profile>
	<id>jtds</id>
	<build>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>sql-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>sqlserver-jtds-ping-test-db</id>
					</execution>
					<execution>
						<id>sqlserver-jtds-ping-seed-db</id>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
</profile>
<profile>
	<id>msjdbc</id>
	<build>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>sql-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>sqlserver-msjdbc-ping-test-db</id>
					</execution>
					<execution>
						<id>sqlserver-msjdbc-ping-seed-db</id>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
</profile>
===== CHILD POM SNIPPET

My intent is that I only execute particular executions if the respective
profile is active.  The thing is, **all** of the executions are being
executed, regardless of which profile ("jtds" or "msjdbc") is active.  So,
if I issue the command "mvn clean initialize -P sqlserver,jtds,...", all of
the executions (sqlserver-jtds-ping-test-db, sqlserver-jtds-ping-seed-db,
sqlserver-msjdbc-ping-test-db, sqlserver-msjdbc-ping-seed-db) are executed. 
Why?

How do I achieve my intent?  I certainly don't want to copy/paste the
executions from the parent pom into all of the child poms; I want to reuse
these executions in various child poms.

Here is the output of one of my child project builds, reflecting the error. 
Notice the first two db pings work correctly; I don't want the second two to
execute, because I'm using the jtds driver to hit sqlserver, and I've yet to
implement msjdbc.

$ mvn clean initialize -P sqlserver,jtds,datanucleus
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO]
------------------------------------------------------------------------
[INFO] Building Application Domain Model 0.1.0.BUILD-SNAPSHOT
[INFO]
------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ app-domain ---
[INFO] Deleting /Users/matthew/Documents/xxx/domain/target
[INFO] 
[INFO] --- sql-maven-plugin:1.5:execute (sqlserver-jtds-ping-test-db) @
app-domain ---
[INFO] Executing commands
[INFO] 1 of 1 SQL statements executed successfully
[INFO] 
[INFO] --- sql-maven-plugin:1.5:execute (sqlserver-jtds-ping-seed-db) @
app-domain ---
[INFO] Executing commands
[INFO] 1 of 1 SQL statements executed successfully
[INFO] 
[INFO] --- sql-maven-plugin:1.5:execute (sqlserver-msjdbc-ping-test-db) @
app-domain ---
[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 0.677s
[INFO] Finished at: Thu Feb 07 16:51:30 CST 2013
[INFO] Final Memory: 4M/81M
[INFO]
------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.codehaus.mojo:sql-maven-plugin:1.5:execute
(sqlserver-msjdbc-ping-test-db) on project app-domain: Driver class not
found: TODO.com.microsoft.sqlserver.jdbc.Driver -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please
read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException



--
View this message in context: http://maven.40175.n5.nabble.com/Problem-reusing-specific-plugin-executions-with-profiles-tp5746276.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


[SOLVED] Re: Problem reusing specific plugin executions with profiles

Posted by Matthew Adams <ma...@matthewadams.me>.
stephenconnolly wrote
> If you then need the executions in the root and only some children... put
> the executions in pluginManagement in the root but without calling out any
> goals. Repeat the executions in 
> <plugins>
>  in the root, calling out the
> goals for those to execute and specifying 
> <inherited>
> false
> </inherited>
>  and
> then finally repeat for the child projects

That did the trick!  Thanks -- I don't think I would've guessed that one. 
Now, the configurations are all in one place.  Nice!

-matthew



--
View this message in context: http://maven.40175.n5.nabble.com/Problem-reusing-specific-plugin-executions-with-profiles-tp5746276p5746396.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


Re: Problem reusing specific plugin executions with profiles

Posted by Matthew Adams <ma...@matthewadams.me>.
Wayne Fay wrote
>> If you then need the executions in the root and only some children... put
>> the executions in pluginManagement in the root but without calling out
>> any
>> goals. Repeat the executions in 
> <plugins>
>  in the root, calling out the
>> goals for those to execute and specifying 
> <inherited>
> false
> </inherited>
>  and
>> then finally repeat for the child projects
> 
> I doubt that solves his problem. He wants to be able to specify from
> the command line which profiles to utilize during this specific build
> of a given module -- so editing poms etc is not going to interest him.
> I could be wrong though.

The reason it solved my problem was because I specify via the command line
the profiles I want to activate, then, in the pom's <profile> sections, I
configure the particular plugin executions I want in the child pom's
<project><profiles><profile><id>...</id><build><plugins> section.

-matthew



--
View this message in context: http://maven.40175.n5.nabble.com/Problem-reusing-specific-plugin-executions-with-profiles-tp5746276p5746397.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


Re: Problem reusing specific plugin executions with profiles

Posted by Wayne Fay <wa...@gmail.com>.
> If you then need the executions in the root and only some children... put
> the executions in pluginManagement in the root but without calling out any
> goals. Repeat the executions in <plugins> in the root, calling out the
> goals for those to execute and specifying <inherited>false</inherited> and
> then finally repeat for the child projects

I doubt that solves his problem. He wants to be able to specify from
the command line which profiles to utilize during this specific build
of a given module -- so editing poms etc is not going to interest him.
I could be wrong though.

Wayne

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


Re: Problem reusing specific plugin executions with profiles

Posted by Stephen Connolly <st...@gmail.com>.
On 8 February 2013 16:57, Matthew Adams <ma...@matthewadams.me> wrote:

> > Please read the above carefully, if you still are 100% certain that
> > profiles are the only solution to your problem, then maybe we can take a
> > look at where things are going wrong...
> >
> > But my earnest belief is that you are heading down a path towards hating
> > maven, and I'd rather try and help you off that path rather than find the
> > obscure tweak needed to help you further down the path you are on
> >
> > -Stephen
>
> Maven profiles suit this task just fine, IMHO.  I could have created a
> generic/contrived/artificial foobar-style example to demonstrate the crux
> of
> the issue, but I was too lazy.  Please don't let my particulars & intent
> cloud the issue at hand, which is why all executions of a plugin, defined
> in
> the pom parent, are being executed when only certain execution ids are
> being
> specified in the child pom.
>
> I'm not a maven newbie.  I'm just using it in a sophisticated way as a
> responsible adult, aware of the tradeoffs.  I appreciate your concern.
>  Now,
> on to the issue at hand.
>
> Can anyone tell me why all executions from the parent pom plugin are being
> executed in the child pom, even though the child is only referencing some
> of
> the parent's executions?
>
>
OK, just wanted to check that you were not doing something stupid first.

Basically, *all* executions are inherited by the child poms unless the
execution has <inherited>false</inherited>

You might be able to turn off executions with some trickery, e.g.

<goals combine.children="override">
</goals>

Or failing that, in the parent pom don't list the goals and then in the
child poms list the goals in the executions you want.

If you then need the executions in the root and only some children... put
the executions in pluginManagement in the root but without calling out any
goals. Repeat the executions in <plugins> in the root, calling out the
goals for those to execute and specifying <inherited>false</inherited> and
then finally repeat for the child projects

HTH

-Stephen


> Thanks,
> Matthew
>
>
>
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/Problem-reusing-specific-plugin-executions-with-profiles-tp5746276p5746373.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
>
>

Re: Problem reusing specific plugin executions with profiles

Posted by Matthew Adams <ma...@matthewadams.me>.
stephenconnolly wrote
> 1. Congratulations on successfully posting XML from Nabble. Until now, I
> genuinely did not think it was possible (as evidenced by the many many
> posts via Nabble where the xml is stripped). I take your success as an
> indication that you are a smart guy with some technical savvy

Yeah, nothing special there.  Copy/paste/worky.
stephenconnolly wrote
> 2. Maven is an opinionated build tool. It really loves to build
> environment
> agnostic artifacts, and it thinks its job is finished when those
> environment agnostic artifacts have been "deployed" into a Maven
> Repository.

ACK
stephenconnolly wrote
> 3. You are building something SaaS-like, so your application requires
> configuration for the environment into which it will be deployed. Maven
> does not really have a good story for these stages in the application life
> cycle (since they take place after the environment agnostic artifact has
> been deployed to a maven repository).

I think you misunderstand my intent.  My build contains integration tests
which must execute successfully against various ORM, database, and jdbc
driver combinations.  The artifacts that are built are indeed
environmentally agnostic.  For example, my domain artifact, which contains
my persistent JPA entities, has a Spring context file that simply requires
an EntityManagerFactory; where that comes from doesn't matter to my
entities.  As long as its present in the Spring configuration, the domain
component is good to go.
stephenconnolly wrote
> The closest to a good story is to
> create a separate module for each destination environment and repackage
> the
> environment agnostic artifact in those modules... Better is to use DevOps
> toolchains to handle this DevOps style task (think chef/puppet)
> 
> Please read my answer to a similar question on stack overflow:
> http://stackoverflow.com/questions/14650468/whats-a-practicable-way-for-automated-configuration-versioning-and-deployment/14661186#14661186

Yeah, that may be true in some cases, but not mine.
stephenconnolly wrote
> The TL;DR is that profiles are not really aimed for use in your use case.
> Yes you can use them, but you probably shouldn't and you will fight maven
> the whole way.
> 
> Please read the above carefully, if you still are 100% certain that
> profiles are the only solution to your problem, then maybe we can take a
> look at where things are going wrong...
> 
> But my earnest belief is that you are heading down a path towards hating
> maven, and I'd rather try and help you off that path rather than find the
> obscure tweak needed to help you further down the path you are on
> 
> -Stephen

Maven profiles suit this task just fine, IMHO.  I could have created a
generic/contrived/artificial foobar-style example to demonstrate the crux of
the issue, but I was too lazy.  Please don't let my particulars & intent
cloud the issue at hand, which is why all executions of a plugin, defined in
the pom parent, are being executed when only certain execution ids are being
specified in the child pom.

I'm not a maven newbie.  I'm just using it in a sophisticated way as a
responsible adult, aware of the tradeoffs.  I appreciate your concern.  Now,
on to the issue at hand.

Can anyone tell me why all executions from the parent pom plugin are being
executed in the child pom, even though the child is only referencing some of
the parent's executions?

Thanks,
Matthew



--
View this message in context: http://maven.40175.n5.nabble.com/Problem-reusing-specific-plugin-executions-with-profiles-tp5746276p5746373.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


Re: Problem reusing specific plugin executions with profiles

Posted by Matthew Adams <ma...@matthewadams.me>.
Yeah, I didn't do anything special to get XML to render.  I remember problems
in the past, but forgot and just blindly pasted into the nabble text editor
from my local text editor...

I'm actually quite dumb.  Just ask my wife.  ;)



--
View this message in context: http://maven.40175.n5.nabble.com/Problem-reusing-specific-plugin-executions-with-profiles-tp5746276p5746372.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


Re: Problem reusing specific plugin executions with profiles

Posted by Wayne Fay <wa...@gmail.com>.
> 1. Congratulations on successfully posting XML from Nabble. Until now, I
> genuinely did not think it was possible (as evidenced by the many many
> posts via Nabble where the xml is stripped). I take your success as an
> indication that you are a smart guy with some technical savvy

No offense to Matthew's natural technical prowess, but I'd expect this
is simply the result of a bug fix on the part of Nabble. I posted a
bug in their Free Support forum a long time ago related to this and
never saw any replies, but I guess someone noticed this eventually:
http://support.nabble.com/XML-does-not-get-posted-properly-to-the-email-list-in-text-format-td6227473.html

Glad to see this is finally working as it should!

Wayne

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


Re: Problem reusing specific plugin executions with profiles

Posted by Stephen Connolly <st...@gmail.com>.
1. Congratulations on successfully posting XML from Nabble. Until now, I
genuinely did not think it was possible (as evidenced by the many many
posts via Nabble where the xml is stripped). I take your success as an
indication that you are a smart guy with some technical savvy

2. Maven is an opinionated build tool. It really loves to build environment
agnostic artifacts, and it thinks its job is finished when those
environment agnostic artifacts have been "deployed" into a Maven Repository.

3. You are building something SaaS-like, so your application requires
configuration for the environment into which it will be deployed. Maven
does not really have a good story for these stages in the application life
cycle (since they take place after the environment agnostic artifact has
been deployed to a maven repository). The closest to a good story is to
create a separate module for each destination environment and repackage the
environment agnostic artifact in those modules... Better is to use DevOps
toolchains to handle this DevOps style task (think chef/puppet)

Please read my answer to a similar question on stack overflow:
http://stackoverflow.com/questions/14650468/whats-a-practicable-way-for-automated-configuration-versioning-and-deployment/14661186#14661186

The TL;DR is that profiles are not really aimed for use in your use case.
Yes you can use them, but you probably shouldn't and you will fight maven
the whole way.

Please read the above carefully, if you still are 100% certain that
profiles are the only solution to your problem, then maybe we can take a
look at where things are going wrong...

But my earnest belief is that you are heading down a path towards hating
maven, and I'd rather try and help you off that path rather than find the
obscure tweak needed to help you further down the path you are on

-Stephen

On Thursday, 7 February 2013, Matthew Adams wrote:

> Background:
> I have a layered architecture, built via a multimodule Maven project, and I
> use profiles to activate which relational database (derby, mysql, or
> sqlserver) & driver (derby, myssql, jtds, or msjdbc) is used for any given
> build.  Obviously, the derby database uses the derby driver, mysql uses
> mysql, but sqlserver can use either jtds or msjdbc (the Microsoft SQL
> Server
> JDBC driver).
>
> If the jtds or msjdbc profile is active, I want to add a database ping
> (that
> is, connect & issue a "select 1") during the initialize phase to ensure
> that
> the intended databases are available over the desired driver.
>
> Vitals:
> $ mvn --version
> Apache Maven 3.0.4 (r1232337; 2012-01-17 02:44:56-0600)
> Maven home: /Applications/springsource/apache-maven-3.0.4
> Java version: 1.6.0_37, vendor: Apple Inc.
> Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
> Default locale: en_US, platform encoding: MacRoman
> OS name: "mac os x", version: "10.7.5", arch: "x86_64", family: "mac"
>
> I have a parent pom that defines the following in its
> project/build/pluginManagement section so that I can ping the database
> server(s) that must be alive when the build runs.  The SQL command I'm
> executing is simply "select 1", and the database
> driver/url/username/password are all pretty straightforward.  Each
> execution
> differs only by the database driver+url combo & the kind of database
> ("test"
> or "seed"), so there are four permutations.
>
> My intent is to use certain of these executions, activated by Maven
> profiles, of course, in various child poms.
>
> ===== PARENT POM SNIPPET
> <plugin>
>         <groupId>org.codehaus.mojo</groupId>
>         <artifactId>sql-maven-plugin</artifactId>
>         <version>${app.sql-maven-plugin.version}</version>
>         <dependencies>
>                 <dependency>
>                         <groupId>net.sourceforge.jtds</groupId>
>                         <artifactId>jtds</artifactId>
>                         <version>${app.jtds.version}</version>
>                 </dependency>
>         </dependencies>
>         <executions>
>                 <execution>
>                         <id>sqlserver-jtds-ping-test-db</id>
>                         <goals>
>                                 <goal>execute</goal>
>                         </goals>
>                         <phase>initialize</phase>
>                         <configuration>
>                                 <driver>${
> app.rdb.sqlserver-jtds.database.driver.name}</driver>
>
> <username>${app.rdb.sqlserver.test.database.username}</username>
>
> <password>${app.rdb.sqlserver.test.database.password}</password>
>
> <url>${app.rdb.sqlserver-jtds.test.database.url}</url>
>
> <sqlCommand>${app.rdb.sqlserver.ping.sql.command}</sqlCommand>
>                         </configuration>
>                 </execution>
>                 <execution>
>                         <id>sqlserver-jtds-ping-seed-db</id>
>                         <goals>
>                                 <goal>execute</goal>
>                         </goals>
>                         <phase>initialize</phase>
>                         <configuration>
>                                 <driver>${
> app.rdb.sqlserver-jtds.database.driver.name}</driver>
>
> <username>${app.rdb.sqlserver.seed.database.username}</username>
>
> <password>${app.rdb.sqlserver.seed.database.password}</password>
>
> <url>${app.rdb.sqlserver-jtds.seed.database.url}</url>
>
> <sqlCommand>${app.rdb.sqlserver.ping.sql.command}</sqlCommand>
>                         </configuration>
>                 </execution>
>                 <execution>
>                         <id>sqlserver-msjdbc-ping-test-db</id>
>                         <goals>
>                                 <goal>execute</goal>
>                         </goals>
>                         <phase>initialize</phase>
>                         <configuration>
>                                 <driver>${
> app.rdb.sqlserver-msjdbc.database.driver.name}</driver>
>
> <username>${app.rdb.sqlserver.test.database.username}</username>
>
> <password>${app.rdb.sqlserver.test.database.password}</password>
>
> <url>${app.rdb.sqlserver-msjdbc.test.database.url}</url>
>
> <sqlCommand>${app.rdb.sqlserver.ping.sql.command}</sqlCommand>
>                         </configuration>
>                 </execution>
>                 <execution>
>                         <id>sqlserver-msjdbc-ping-seed-db</id>
>                         <goals>
>                                 <goal>execute</goal>
>                         </goals>
>                         <phase>initialize</phase>
>                         <configuration>
>                                 <driver>${
> app.rdb.sqlserver-msjdbc.database.driver.name}</driver>
>
> <username>${app.rdb.sqlserver.seed.database.username}</username>
>
> <password>${app.rdb.sqlserver.seed.database.password}</password>
>
> <url>${app.rdb.sqlserver-msjdbc.seed.database.url}</url>
>
> <sqlCommand>${app.rdb.sqlserver.ping.sql.command}</sqlCommand>
>                         </configuration>
>                 </execution>
>         </executions>
> </plugin>
> ===== PARENT POM SNIPPET
>
> So far, so good.  In a child pom, I have the following profiles, defined in
> its project/profiles section.
>
> ===== CHILD POM SNIPPET
> <profile>
>         <id>jtds</id>
>         <build>
>                 <plugins>
>                         <plugin>
>                                 <groupId>org.codehaus.mojo</groupId>
>                                 <artifactId>sql-maven-plugin</artifactId>
>                                 <executions>
>                                         <execution>
>
> <id>sqlserver-jtds-ping-test-db</id>
>                                         </execution>
>                                         <execution>
>
> <id>sqlserver-jtds-ping-seed-db</id>
>                                         </execution>
>                                 </executions>
>                         </plugin>
>                 </plugins>
>         </build>
> </profile>
> <profile>
>         <id>msjdbc</id>
>         <build>
>                 <plugins>
>                         <plugin>
>                                 <groupId>org.codehaus.mojo</groupId>
>                                 <artifactId>sql-maven-plugin</artifactId>
>                                 <executions>
>                                         <execution>
>
> <id>sqlserver-msjdbc-ping-test-db</id>
>                                         </execution>
>                                         <execution>
>
> <id>sqlserver-msjdbc-ping-seed-db</id>
>                                         </execution>
>                                 </executions>
>                         </plugin>
>                 </plugins>
>         </build>
> </profile>
> ===== CHILD POM SNIPPET
>
> My intent is that I only execute particular executions if the respective
> profile is active.  The thing is, **all** of the executions are being
> executed, regardless of which profile ("jtds" or "msjdbc") is active.  So,
> if I issue the command "mvn clean initialize -P sqlserver,jtds,...", all of
> the executions (sqlserver-jtds-ping-test-db, sqlserver-jtds-ping-seed-db,
> sqlserver-msjdbc-ping-test-db, sqlserver-msjdbc-ping-seed-db) are executed.
> Why?
>
> How do I achieve my intent?  I certainly don't want to copy/paste the
> executions from the parent pom into all of the child poms; I want to reuse
> these executions in various child poms.
>
> Here is the output of one of my child project builds, reflecting the error.
> Notice the first two db pings work correctly; I don't want the second two
> to
> execute, because I'm using the jtds driver to hit sqlserver, and I've yet
> to
> implement msjdbc.
>
> $ mvn clean initialize -P sqlserver,jtds,datanucleus
> [INFO] Scanning for projects...
> [INFO]
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Building Application Domain Model 0.1.0.BUILD-SNAPSHOT
> [INFO]
> ------------------------------------------------------------------------
> [INFO]
> [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ app-domain ---
> [INFO] Deleting /Users/matthew/Documents/xxx/domain/target
> [INFO]
> [INFO] --- sql-maven-plugin:1.5:execute (sqlserver-jtds-ping-test-db) @
> app-domain ---
> [INFO] Executing commands
> [INFO] 1 of 1 SQL statements executed successfully
> [INFO]
> [INFO] --- sql-maven-plugin:1.5:execute (sqlserver-jtds-ping-seed-db) @
> app-domain ---
> [INFO] Executing commands
> [INFO] 1 of 1 SQL statements executed successfully
> [INFO]
> [INFO] --- sql-maven-plugin:1.5:execute (sqlserver-msjdbc-ping-test-db) @
> app-domain ---
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 0.677s
> [INFO] Finished at: Thu Feb 07 16:51:30 CST 2013
> [INFO] Final Memory: 4M/81M
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] Failed to execute goal
> org.codehaus.mojo:sql-maven-plugin:1.5:execute
> (sqlserver-msjdbc-ping-test-db) on project app-domain: Driver class not
> found: TODO.com.microsoft.sqlserver.jdbc.Driver -> [Help 1]
> [ERROR]
> [ERROR] To see the full stack trace of the errors, re-run Maven with the -e
> switch.
> [ERROR] Re-run Maven using the -X switch to enable full debug logging.
> [ERROR]
> [ERROR] For more information about the errors and possible solutions,
> please
> read the following articles:
> [ERROR] [Help 1]
> http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
>
>
>
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/Problem-reusing-specific-plugin-executions-with-profiles-tp5746276.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For addi