Can the switchyard-plugin be configured to ignore target resources defined in a parent pom?
susanacabaco Jul 16, 2013 7:20 AMHi,
I have a common project that defines some resources that are not used in every children, and the definition goes something like this:
{code}
<build>
<resources>
<resource>
<directory>${path.input.generated.resources}</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
...
{code}
This very same common project defines a plugin management section where I specify which is the switchyard-plugin that can be used in the child projects:
{code}
...
<pluginManagement>
<plugins>
<plugin>
<groupId>org.switchyard</groupId>
<artifactId>switchyard-plugin</artifactId>
<version>${version.switchyard-plugin}</version>
<executions>
<execution>
<goals>
<goal>configure</goal>
</goals>
</execution>
</executions>
</plugin>
...
</pluginManagement>
..
{code}
The problem is that in the children where those target resources directory mentioned above does not exist, I will get a build failure looking like this:
{code}
[INFO] --- switchyard-plugin:0.8.0.Final:configure (default) @ sampleProjectA ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.898s
[INFO] Finished at: Tue Jul 16 12:54:30 CEST 2013
[INFO] Final Memory: 38M/1237M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.switchyard:switchyard-plugin:0.8.0.Final:configure (default) on project sampleProjectA: basedir /workspace/projects/sampleProjectA/target/generated-resources does not exist -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.switchyard:switchyard-plugin:0.8.0.Final:configure (default) on project sampleProjectA: basedir /workspace/projects/sampleProjectA/target/generated-resources does not exist
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: basedir /workspace/projects/sampleProjectA/target/generated-resources does not exist
at org.switchyard.tools.maven.plugins.switchyard.ConfigureMojo.execute(ConfigureMojo.java:182)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: java.lang.IllegalStateException: basedir /workspace/projects/sampleProjectA/target/generated-resources does not exist
at org.codehaus.plexus.util.DirectoryScanner.scan(DirectoryScanner.java:542)
at org.codehaus.plexus.util.FileUtils.getFileNames(FileUtils.java:1402)
at org.codehaus.plexus.util.FileUtils.getFileNames(FileUtils.java:1368)
at org.codehaus.plexus.util.FileUtils.getFiles(FileUtils.java:1340)
at org.codehaus.plexus.util.FileUtils.getFiles(FileUtils.java:1334)
at org.switchyard.tools.maven.plugins.switchyard.ConfigureMojo.addModelPullerScanner(ConfigureMojo.java:227)
at org.switchyard.tools.maven.plugins.switchyard.ConfigureMojo.addModelPullerScanners(ConfigureMojo.java:207)
at org.switchyard.tools.maven.plugins.switchyard.ConfigureMojo.execute(ConfigureMojo.java:141)
... 21 more
{code}
Naturally, if I remove the resource from the parent, it will work. But it has to stay there, just not used in every child project.
So, the question is, can I somehow make it be ignored in the child projects that actually use the switchyard-plugin? How?
Thanks!