multi module projects

21 views
Skip to first unread message

grimsell

unread,
Aug 11, 2009, 9:52:59 AM8/11/09
to maven-config-processor-users
I have just realized that I have a problem with multi module projects.
My setup is that I have a maven project using MCP which is a module in
a parent project.

My plugin configuration looks like this:
<plugin>
<groupId>com.google.code.maven-config-processor-plugin</groupId>
<artifactId>maven-config-processor-plugin</artifactId>
<version>1.8-20090807.144550-1</version>
<configuration>
<encoding>ISO-8859-1</encoding>
<transformations>
<transformation>
<type>properties</type>
<input>file:${project.build.directory}/iipax-zip/config/
application.config.inst</input>
<output>modified-files/config/application.config.inst</output>
<config>src/main/assembly/properties-processing.xml</config>
</transformation>
<transformation>
<type>properties</type>
<input>file:${project.build.directory}/iipax-zip/etc/webstart/
application.config.inst.client</input>
<output>modified-files/etc/webstart/
application.config.inst.client</output>
<config>src/main/assembly/client-properties-processing.xml</
config>
</transformation>
</transformations>
</configuration>
<executions>
<execution>
<id>config-process</id>
<phase>process-resources</phase>
<goals>
<goal>process</goal>
</goals>
</execution>
</executions>
</plugin>

When building the project itself everything works fine. When building
the parent project however I get the error below. Is it a
configuration mistake or is teh plugin itself dependent on the current
directory of the maven process?




Downloading:
http://maven.idainfront.se:9001/proxy/repository/file/C/\svn\idainfront\kam\zip\target/iipax-zip/config/application.config.inst/C-\svn\idainfront\kam\zip\target/iipax-zip/config/application.config.inst.jar
Downloading:
http://repo1.maven.org/maven2/file/C/\svn\idainfront\kam\zip\target/iipax-zip/config/application.config.inst/C-\svn\idainfront\kam\zip\target/iipax-zip/config/application.config.inst.jar
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Error during config processing

Embedded error: File not found [src/main/assembly/properties-
processing.xml]
[1] [INFO] File: C:\svn\idainfront\kam\file:C:\svn\idainfront\kam\zip
\target\iipax-zip\config\application.config.inst does not exist.

[2] [INFO] Failed to resolve classpath resource: file:C:\svn\idainfront
\kam\zip\target/iipax-zip/config/application.config.inst from
classloader: org.codehaus.classworlds.RealmClassLoader@11415c8

[3] [INFO] Failed to resolve artifact: file:C:jar:\svn\idainfront\kam
\zip\target/iipax-zip/config/application.config.inst for location:
file:C:\svn\idainfront\kam\zip\target/iipax-zip/config/
application.config.inst
Error:
org.apache.maven.artifact.resolver.ArtifactNotFoundException: Unable
to download the artifact from any repository

Try downloading the file manually from the project website.

Then, install it using the command:
mvn install:install-file -DgroupId=file -DartifactId=C -Dversion=
\svn\idainfront\kam\zip\target/iipax-zip/config/
application.config.inst -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file
there:
mvn deploy:deploy-file -DgroupId=file -DartifactId=C -Dversion=\svn
\idainfront\kam\zip\target/iipax-zip/config/application.config.inst -
Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]


file:C:jar:\svn\idainfront\kam\zip\target/iipax-zip/config/
application.config.inst

from the specified remote repositories:
central (http://repo1.maven.org/maven2),
idainfront (http://maven.idainfront.se:9001/proxy/repository)

at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve
(DefaultArtifactResolver.java:212)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve
(DefaultArtifactResolver.java:74)
at org.apache.maven.shared.io.location.ArtifactLocatorStrategy.resolve
(ArtifactLocatorStrategy.java:133)
at org.apache.maven.shared.io.location.Locator.resolve(Locator.java:
81)
at com.google.code.configprocessor.maven.MavenFileResolver.resolve
(MavenFileResolver.java:46)
at com.google.code.configprocessor.ConfigProcessor.execute
(ConfigProcessor.java:74)
at com.google.code.configprocessor.ConfigProcessorMojo.execute
(ConfigProcessorMojo.java:197)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo
(DefaultPluginManager.java:451)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals
(DefaultLifecycleExecutor.java:558)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle
(DefaultLifecycleExecutor.java:499)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
(DefaultLifecycleExecutor.java:478)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
(DefaultLifecycleExecutor.java:330)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments
(DefaultLifecycleExecutor.java:291)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute
(DefaultLifecycleExecutor.java:142)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:
315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:
430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.wagon.ResourceDoesNotExistException:
Unable to download the artifact from any repository
at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact
(DefaultWagonManager.java:331)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve
(DefaultArtifactResolver.java:200)
... 24 more


[4] [INFO] File: C:\svn\idainfront\kam\src\main\assembly\properties-
processing.xml does not exist.

[5] [INFO] Failed to resolve classpath resource: src/main/assembly/
properties-processing.xml from classloader:
org.codehaus.classworlds.RealmClassLoader@11415c8

[6] [INFO] Invalid artifact specification: 'src/main/assembly/
properties-processing.xml'. Must contain at least three fields,
separated by ':'.

[7] [INFO] Building URL from location: src/main/assembly/properties-
processing.xml
Error:
java.net.MalformedURLException: no protocol: src/main/assembly/
properties-processing.xml
at java.net.URL.<init>(URL.java:567)
at java.net.URL.<init>(URL.java:464)
at java.net.URL.<init>(URL.java:413)
at org.apache.maven.shared.io.location.URLLocatorStrategy.resolve
(URLLocatorStrategy.java:54)
at org.apache.maven.shared.io.location.Locator.resolve(Locator.java:
81)
at com.google.code.configprocessor.maven.MavenFileResolver.resolve
(MavenFileResolver.java:46)
at com.google.code.configprocessor.ConfigProcessor.execute
(ConfigProcessor.java:75)
at com.google.code.configprocessor.ConfigProcessorMojo.execute
(ConfigProcessorMojo.java:197)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo
(DefaultPluginManager.java:451)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals
(DefaultLifecycleExecutor.java:558)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle
(DefaultLifecycleExecutor.java:499)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
(DefaultLifecycleExecutor.java:478)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
(DefaultLifecycleExecutor.java:330)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments
(DefaultLifecycleExecutor.java:291)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute
(DefaultLifecycleExecutor.java:142)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:
315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:
430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

Leandro de Oliveira

unread,
Aug 11, 2009, 10:49:07 AM8/11/09
to maven-config-p...@googlegroups.com
The property ${project.build.directory} is the directory containing
the artifacts generated during build, so it varies depending on the
module being built.

Maven plugins inherit configuration of parent poms and can override
them. I've added a new configuration option "skip" to disable the
plugin execution, so you can configure the plugin in the parent pom
and disable it for children modules.

2009/8/11 grimsell <grim...@gmail.com>:

grimsell

unread,
Aug 11, 2009, 11:19:29 AM8/11/09
to maven-config-processor-users
I'm not sure if I understand correctly but MCP is only configured in
one child module.
When building only that child it works but when building the parent it
doesn't.

I dont think the problem is the input file but the relative paths of
the config file.

If I change the config-tag like this it works:
<config>zip/src/main/assembly/client-properties-processing.xml</
config>

"zip" is the directory of the child module. Of course now it doesn't
work to build the child module on its own.

I have the same problem in the actual processing configuration where
I've specified a ralative path like this:

<processor>
<add>
<file>src/main/assembly/extra-application.config</file>
<after>security.secondInstallFile.case</after>
</add>
</processor>

On Aug 11, 4:49 pm, Leandro de Oliveira <lehph...@gmail.com> wrote:
> The property ${project.build.directory} is the directory containing
> the artifacts generated during build, so it varies depending on the
> module being built.
>
> Maven plugins inherit configuration of parent poms and can override
> them. I've added a new configuration option "skip" to disable the
> plugin execution, so you can configure the plugin in the parent pom
> and disable it for children modules.
>
> 2009/8/11 grimsell <grims...@gmail.com>:
> ...
>
> read more »

Leandro de Oliveira

unread,
Aug 11, 2009, 1:40:45 PM8/11/09
to maven-config-p...@googlegroups.com
Looking for this kind of problem, I've found this:
http://maven.apache.org/plugin-developers/common-bugs.html#Resolving_Relative_Paths

I think the class
org.apache.maven.shared.io.location.FileLocatorStrategy should handle
this, but it doesn't, so I've implemented one to resolve relative
paths.

The new snapshot pom.xml file is here:
http://oss.sonatype.org/content/repositories/googlecode-snapshots/com/google/code/maven-config-processor-plugin/maven-config-processor-plugin/1.8-SNAPSHOT/maven-config-processor-plugin-1.8-20090811.173713-4.pom

2009/8/11 grimsell <grim...@gmail.com>:

grimsell

unread,
Aug 11, 2009, 1:59:01 PM8/11/09
to maven-config-processor-users
Yes, that works fine.
And now I dont have to have the "file:" prefix on the input file
either.

I had a look at the maven assembly plugin and they have also made
their own RelativeFileLocatorStrategy.
http://maven.apache.org/plugins/maven-assembly-plugin/apidocs/org/apache/maven/plugin/assembly/io/RelativeFileLocatorStrategy.html

Thanks a lot for your help!

On Aug 11, 7:40 pm, Leandro de Oliveira <lehph...@gmail.com> wrote:
> Looking for this kind of problem, I've found this:http://maven.apache.org/plugin-developers/common-bugs.html#Resolving_...
>
> I think the class
> org.apache.maven.shared.io.location.FileLocatorStrategy should handle
> this, but it doesn't, so I've implemented one to resolve relative
> paths.
>
> The new snapshot pom.xml file is here:http://oss.sonatype.org/content/repositories/googlecode-snapshots/com...
>
> 2009/8/11 grimsell <grims...@gmail.com>:
> ...
>
> read more »

Leandro de Oliveira

unread,
Aug 11, 2009, 2:53:40 PM8/11/09
to maven-config-p...@googlegroups.com
> I had a look at the maven assembly plugin and they have also made
> their own RelativeFileLocatorStrategy.

What a coincidence! :-)

Thank you for your bug reporting, I'm glad it is working for you now.

2009/8/11 grimsell <grim...@gmail.com>:
Reply all
Reply to author
Forward
0 new messages