You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Severin Ecker <se...@gmx.at> on 2007/07/08 14:08:06 UTC
copy 'resources' to arbitrary directory
Hi,
I seem to just can't figure out how i can copy files from an arbitrary
location to an arbitrary location.
I have some XML schema files in my source directory and since i'm using
these as source they clearly don't fit in the resource directory. so i
guess to have them automatically copied to the target dir i should just
add the location they're in as a resource directory right?
(i've tried some different configurations but couldn't even get that
working... could someone please enlighten me what's wrong with this,
because it's being ignored and only the default resource directory is
being processed?
<build>
<plugins>
<!-- .... -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<resources>
<resource>
<directory>src/main/xsd</directory>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
</build>
)
anyway. i need those resources in some specific directory in the output,
not just in target/classes but target/classes/mydir. what i don't want
is to reflect this specific output need in the source directories.
in short.. is there any way in maven to copy files or do i have to write
an ant task for that?
thanks in advance!
cheers,
severin
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: copy 'resources' to arbitrary directory
Posted by Severin Ecker <se...@gmx.at>.
hi,
hmm, either i'm stupid or i spelled something wrong, cause when i tried
this last time, maven told me that's an incorrect pom according to the
schema.
let's try with copy&paste this time ;)
thanks though
cheers,
severin
Tim Kettler wrote:
> Hi,
>
> no need to configure the resource plugin to add additional resources.
> Just add a new resource specification to your pom like this:
>
> <project>
> <build>
> <resources>
> <resource>
> <targetPath>mydir</targetPath>
> <directory>src/main/xsd</directory>
> </resource>
> </resources>
> </build>
> </project>
>
> -Tim
>
> Severin Ecker schrieb:
>> Hi,
>>
>> I seem to just can't figure out how i can copy files from an
>> arbitrary location to an arbitrary location.
>> I have some XML schema files in my source directory and since i'm
>> using these as source they clearly don't fit in the resource
>> directory. so i guess to have them automatically copied to the target
>> dir i should just add the location they're in as a resource directory
>> right?
>>
>> (i've tried some different configurations but couldn't even get that
>> working... could someone please enlighten me what's wrong with this,
>> because it's being ignored and only the default resource directory is
>> being processed?
>> <build>
>> <plugins>
>> <!-- .... -->
>> <plugin>
>> <groupId>org.apache.maven.plugins</groupId>
>> <artifactId>maven-resources-plugin</artifactId>
>> <configuration>
>> <resources>
>> <resource>
>> <directory>src/main/xsd</directory>
>> </resource>
>> </resources>
>> </configuration>
>> </plugin>
>> </plugins>
>> </build>
>> )
>>
>> anyway. i need those resources in some specific directory in the
>> output, not just in target/classes but target/classes/mydir. what i
>> don't want is to reflect this specific output need in the source
>> directories.
>>
>> in short.. is there any way in maven to copy files or do i have to
>> write an ant task for that?
>>
>> thanks in advance!
>> cheers,
>> severin
>>
>>
>> ---------------------------------------------------------------------
>> 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 'resources' to arbitrary directory
Posted by Severin Ecker <se...@gmx.at>.
hi,
well the targetPath was actually all that i needed. i couldn't find that
one anywhere in the resource plugin page, might be worth adding it
somewhere (e.g. in the examples)
cheers,
severin
Paul Copeland wrote:
> The problem I ran into with this is that targetPath is relative to the
> classes directory for jar and war packing types. So if you want your
> xml files to go anywhere else Maven is just going to be way too
> helpful and not let you. I gave up and used an ant task for copying.
> If there is a way to use the resources plugin I be interested in
> knowing the undocumented trick.
>
> On 7/8/2007 7:54 AM, Tim Kettler wrote:
>> Hi,
>>
>> no need to configure the resource plugin to add additional resources.
>> Just add a new resource specification to your pom like this:
>>
>> <project>
>> <build>
>> <resources>
>> <resource>
>> <targetPath>mydir</targetPath>
>> <directory>src/main/xsd</directory>
>> </resource>
>> </resources>
>> </build>
>> </project>
>>
>> -Tim
>>
>> Severin Ecker schrieb:
>>> Hi,
>>>
>>> I seem to just can't figure out how i can copy files from an
>>> arbitrary location to an arbitrary location.
>>> I have some XML schema files in my source directory and since i'm
>>> using these as source they clearly don't fit in the resource
>>> directory. so i guess to have them automatically copied to the
>>> target dir i should just add the location they're in as a resource
>>> directory right?
>>>
>>> (i've tried some different configurations but couldn't even get that
>>> working... could someone please enlighten me what's wrong with this,
>>> because it's being ignored and only the default resource directory
>>> is being processed?
>>> <build>
>>> <plugins>
>>> <!-- .... -->
>>> <plugin>
>>> <groupId>org.apache.maven.plugins</groupId>
>>> <artifactId>maven-resources-plugin</artifactId>
>>> <configuration>
>>> <resources>
>>> <resource>
>>> <directory>src/main/xsd</directory>
>>> </resource>
>>> </resources>
>>> </configuration>
>>> </plugin>
>>> </plugins>
>>> </build>
>>> )
>>>
>>> anyway. i need those resources in some specific directory in the
>>> output, not just in target/classes but target/classes/mydir. what i
>>> don't want is to reflect this specific output need in the source
>>> directories.
>>>
>>> in short.. is there any way in maven to copy files or do i have to
>>> write an ant task for that?
>>>
>>> thanks in advance!
>>> cheers,
>>> severin
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: copy 'resources' to arbitrary directory
Posted by Paul Copeland <te...@jotobjects.com>.
The problem I ran into with this is that targetPath is relative to the
classes directory for jar and war packing types. So if you want your xml
files to go anywhere else Maven is just going to be way too helpful and
not let you. I gave up and used an ant task for copying. If there is a
way to use the resources plugin I be interested in knowing the
undocumented trick.
On 7/8/2007 7:54 AM, Tim Kettler wrote:
> Hi,
>
> no need to configure the resource plugin to add additional resources.
> Just add a new resource specification to your pom like this:
>
> <project>
> <build>
> <resources>
> <resource>
> <targetPath>mydir</targetPath>
> <directory>src/main/xsd</directory>
> </resource>
> </resources>
> </build>
> </project>
>
> -Tim
>
> Severin Ecker schrieb:
>> Hi,
>>
>> I seem to just can't figure out how i can copy files from an
>> arbitrary location to an arbitrary location.
>> I have some XML schema files in my source directory and since i'm
>> using these as source they clearly don't fit in the resource
>> directory. so i guess to have them automatically copied to the target
>> dir i should just add the location they're in as a resource directory
>> right?
>>
>> (i've tried some different configurations but couldn't even get that
>> working... could someone please enlighten me what's wrong with this,
>> because it's being ignored and only the default resource directory is
>> being processed?
>> <build>
>> <plugins>
>> <!-- .... -->
>> <plugin>
>> <groupId>org.apache.maven.plugins</groupId>
>> <artifactId>maven-resources-plugin</artifactId>
>> <configuration>
>> <resources>
>> <resource>
>> <directory>src/main/xsd</directory>
>> </resource>
>> </resources>
>> </configuration>
>> </plugin>
>> </plugins>
>> </build>
>> )
>>
>> anyway. i need those resources in some specific directory in the
>> output, not just in target/classes but target/classes/mydir. what i
>> don't want is to reflect this specific output need in the source
>> directories.
>>
>> in short.. is there any way in maven to copy files or do i have to
>> write an ant task for that?
>>
>> thanks in advance!
>> cheers,
>> severin
>>
>>
>> ---------------------------------------------------------------------
>> 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 'resources' to arbitrary directory
Posted by Tim Kettler <ti...@udo.edu>.
Hi,
no need to configure the resource plugin to add additional resources.
Just add a new resource specification to your pom like this:
<project>
<build>
<resources>
<resource>
<targetPath>mydir</targetPath>
<directory>src/main/xsd</directory>
</resource>
</resources>
</build>
</project>
-Tim
Severin Ecker schrieb:
> Hi,
>
> I seem to just can't figure out how i can copy files from an arbitrary
> location to an arbitrary location.
> I have some XML schema files in my source directory and since i'm using
> these as source they clearly don't fit in the resource directory. so i
> guess to have them automatically copied to the target dir i should just
> add the location they're in as a resource directory right?
>
> (i've tried some different configurations but couldn't even get that
> working... could someone please enlighten me what's wrong with this,
> because it's being ignored and only the default resource directory is
> being processed?
> <build>
> <plugins>
> <!-- .... -->
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-resources-plugin</artifactId>
> <configuration>
> <resources>
> <resource>
> <directory>src/main/xsd</directory>
> </resource>
> </resources>
> </configuration>
> </plugin>
> </plugins>
> </build>
> )
>
> anyway. i need those resources in some specific directory in the output,
> not just in target/classes but target/classes/mydir. what i don't want
> is to reflect this specific output need in the source directories.
>
> in short.. is there any way in maven to copy files or do i have to write
> an ant task for that?
>
> thanks in advance!
> cheers,
> severin
>
>
> ---------------------------------------------------------------------
> 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 'resources' to arbitrary directory
Posted by Wendy Smoak <ws...@gmail.com>.
On 7/8/07, Severin Ecker <se...@gmx.at> wrote:
> I seem to just can't figure out how i can copy files from an arbitrary
> location to an arbitrary location.
I think most people use the antrun plugin and a 'copy' task for that.
By convention, resources belong in src/main/resources and get copied
to target/classes.
I see you've found another way to do it... if you'd like, you can add
an example to the wiki page for the resources plugin:
http://docs.codehaus.org/display/MAVENUSER/MavenPlugins
--
Wendy
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org