You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Will Hoover <ja...@gmail.com> on 2010/07/21 15:49:33 UTC

Copy target file from another module

I have a multi-module project where one of the modules needs to copy
internally generated file(s) that do not come from any maven-aware resources
from a module to a WAR module for inclusion. The following works, but it
seems like a hack using <directory> to get to the module where the file(s)
exist. Is there a better way?


WAR module:
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
	
<artifactId>maven-resources-plugin</artifactId>
				<executions>
					<execution>
						<phase>validate</phase>
						<goals>
	
<goal>copy-resources</goal>
						</goals>
						<configuration>
	
<outputDirectory>${project.build.directory}/${project.build.finalName}</outp
utDirectory>
							<resources>
								<resource>
	
<directory>${basedir}/../other-module-with-generated-files/target</directory
>
	
<filtering>false</filtering>
								</resource>
							</resources>
						</configuration>
					</execution>
				</executions>
			</plugin> 


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


RE: Copy target file from another module

Posted by Will Hoover <ja...@gmail.com>.
Thanks for your reply, but unfortunately the module that I'm attempting to
copy file(s) from has a set packaging that is not a WAR :/

-----Original Message-----
From: Thomas Markus [mailto:t.markus@proventis.net] 
Sent: Wednesday, July 21, 2010 10:01 AM
To: Maven Users List
Subject: Re: Copy target file from another module

  Hi,

create a war with your generated sources and use it as a war overlay

regards
Thomas


Am 21.07.2010 15:49, schrieb Will Hoover:
> I have a multi-module project where one of the modules needs to copy
> internally generated file(s) that do not come from any maven-aware
resources
> from a module to a WAR module for inclusion. The following works, but it
> seems like a hack using<directory>  to get to the module where the file(s)
> exist. Is there a better way?
>
>
> WAR module:
> 			<plugin>
> 				<groupId>org.apache.maven.plugins</groupId>
> 	
> <artifactId>maven-resources-plugin</artifactId>
> 				<executions>
> 					<execution>
> 						<phase>validate</phase>
> 						<goals>
> 	
> <goal>copy-resources</goal>
> 						</goals>
> 						<configuration>
> 	
>
<outputDirectory>${project.build.directory}/${project.build.finalName}</outp
> utDirectory>
> 							<resources>
> 								<resource>
> 	
>
<directory>${basedir}/../other-module-with-generated-files/target</directory
> 	
> <filtering>false</filtering>
> 								</resource>
> 							</resources>
> 						</configuration>
> 					</execution>
> 				</executions>
> 			</plugin>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>


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


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


Re: Copy target file from another module

Posted by Thomas Markus <t....@proventis.net>.
  Hi,

create a war with your generated sources and use it as a war overlay

regards
Thomas


Am 21.07.2010 15:49, schrieb Will Hoover:
> I have a multi-module project where one of the modules needs to copy
> internally generated file(s) that do not come from any maven-aware resources
> from a module to a WAR module for inclusion. The following works, but it
> seems like a hack using<directory>  to get to the module where the file(s)
> exist. Is there a better way?
>
>
> WAR module:
> 			<plugin>
> 				<groupId>org.apache.maven.plugins</groupId>
> 	
> <artifactId>maven-resources-plugin</artifactId>
> 				<executions>
> 					<execution>
> 						<phase>validate</phase>
> 						<goals>
> 	
> <goal>copy-resources</goal>
> 						</goals>
> 						<configuration>
> 	
> <outputDirectory>${project.build.directory}/${project.build.finalName}</outp
> utDirectory>
> 							<resources>
> 								<resource>
> 	
> <directory>${basedir}/../other-module-with-generated-files/target</directory
> 	
> <filtering>false</filtering>
> 								</resource>
> 							</resources>
> 						</configuration>
> 					</execution>
> 				</executions>
> 			</plugin>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>


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


RE: Copy target file from another module

Posted by Will Hoover <ja...@gmail.com>.
The problem is the generated sources are created during compilation within
the module. The WAR module already has a dependency for that module, but
some of the generated sources are not part of the normal maven build. So,
what happens is the target of the WAR only contains the packaged dependency,
not the generated file(s) that exist in the other modules target (thus the
hack to copy them). Unfortunately, I cannot change the packaging of the
other module to WAR to do an overlay :/

-----Original Message-----
From: thomas.k.sundberg@gmail.com [mailto:thomas.k.sundberg@gmail.com] On
Behalf Of Thomas Sundberg
Sent: Wednesday, July 21, 2010 10:02 AM
To: Maven Users List
Subject: Re: Copy target file from another module

Hi!

Why not do it the Maven way and create a module with the generated
sources and make the other (2?) modules dependant of it?
This would eliminate the need of a hack that copy files from one
module to another.

/Thomas

On Wed, Jul 21, 2010 at 15:49, Will Hoover <ja...@gmail.com> wrote:
> I have a multi-module project where one of the modules needs to copy
> internally generated file(s) that do not come from any maven-aware
resources
> from a module to a WAR module for inclusion. The following works, but it
> seems like a hack using <directory> to get to the module where the file(s)
> exist. Is there a better way?
>
>
> WAR module:
>                        <plugin>
>                                <groupId>org.apache.maven.plugins</groupId>
>
> <artifactId>maven-resources-plugin</artifactId>
>                                <executions>
>                                        <execution>
>                                                <phase>validate</phase>
>                                                <goals>
>
> <goal>copy-resources</goal>
>                                                </goals>
>                                                <configuration>
>
>
<outputDirectory>${project.build.directory}/${project.build.finalName}</outp
> utDirectory>
>                                                        <resources>
>                                                                <resource>
>
>
<directory>${basedir}/../other-module-with-generated-files/target</directory
>>
>
> <filtering>false</filtering>
>                                                                </resource>
>                                                        </resources>
>                                                </configuration>
>                                        </execution>
>                                </executions>
>                        </plugin>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>



-- 
Thomas Sundberg
M. Sc. in Computer Science

Mobile: +46 70 767 33 15
Blog: http://thomassundberg.wordpress.com/
Twitter: @thomassundberg

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


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


Re: Copy target file from another module

Posted by Thomas Sundberg <ts...@kth.se>.
Hi!

Why not do it the Maven way and create a module with the generated
sources and make the other (2?) modules dependant of it?
This would eliminate the need of a hack that copy files from one
module to another.

/Thomas

On Wed, Jul 21, 2010 at 15:49, Will Hoover <ja...@gmail.com> wrote:
> I have a multi-module project where one of the modules needs to copy
> internally generated file(s) that do not come from any maven-aware resources
> from a module to a WAR module for inclusion. The following works, but it
> seems like a hack using <directory> to get to the module where the file(s)
> exist. Is there a better way?
>
>
> WAR module:
>                        <plugin>
>                                <groupId>org.apache.maven.plugins</groupId>
>
> <artifactId>maven-resources-plugin</artifactId>
>                                <executions>
>                                        <execution>
>                                                <phase>validate</phase>
>                                                <goals>
>
> <goal>copy-resources</goal>
>                                                </goals>
>                                                <configuration>
>
> <outputDirectory>${project.build.directory}/${project.build.finalName}</outp
> utDirectory>
>                                                        <resources>
>                                                                <resource>
>
> <directory>${basedir}/../other-module-with-generated-files/target</directory
>>
>
> <filtering>false</filtering>
>                                                                </resource>
>                                                        </resources>
>                                                </configuration>
>                                        </execution>
>                                </executions>
>                        </plugin>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>



-- 
Thomas Sundberg
M. Sc. in Computer Science

Mobile: +46 70 767 33 15
Blog: http://thomassundberg.wordpress.com/
Twitter: @thomassundberg

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