You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by youhaodeyi <yo...@gmail.com> on 2009/02/26 14:11:33 UTC

How to copy resource files to target/classes directory?

I have may XML files in src/main/java directory and its sub directory. When I
run "mvn compile", these XML files will not be copied to the target/classes
directory. I know I can put these files in src/main/resources directory but
it is really hard work for me. How can I let maven do this? 
-- 
View this message in context: http://www.nabble.com/How-to-copy-resource-files-to-target-classes-directory--tp22223747p22223747.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: How to copy resource files to target/classes directory?

Posted by ji...@gmail.com.
Hello,

On Thu, Feb 26, 2009 at 8:11 AM, youhaodeyi <yo...@gmail.com> wrote:
>
> I have may XML files in src/main/java directory and its sub directory. When I
> run "mvn compile", these XML files will not be copied to the target/classes
> directory. I know I can put these files in src/main/resources directory but
> it is really hard work for me. How can I let maven do this?

Maven seems like a bad choice for this. Why don't you just...

bash$ tar --wildcards --exclude '*.java' --exclude '.svn' --create
--directory src/main/java --file - . | tar --extract --directory
src/main/resources --file -

-jesse

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


RE: How to copy resource files to target/classes directory?

Posted by James Bowkett <JB...@cygnanegra.co.uk>.
You could over ride your resources directory in your pom.xml:

        <resources>
            <!-- Log4j.xml etc -->
            <resource>
                <directory>${basedir}/src/main/java</directory>
            </resource>
		<!-- Or you could use the following example: -->
            <resource>
                <targetPath>path/to/destination/</targetPath>
                <directory>${basedir}/src/main/java/ </directory>
                <includes>
                    <include>**.xml</include>
                </includes>
                <filtering>false</filtering>
            </resource>
	</resources>

-----Original Message-----
From: youhaodeyi [mailto:youhaodeyi@gmail.com] 
Sent: 26 February 2009 13:12
To: users@maven.apache.org
Subject: How to copy resource files to target/classes directory?


I have may XML files in src/main/java directory and its sub directory. When
I
run "mvn compile", these XML files will not be copied to the target/classes
directory. I know I can put these files in src/main/resources directory but
it is really hard work for me. How can I let maven do this? 
-- 
View this message in context:
http://www.nabble.com/How-to-copy-resource-files-to-target-classes-directory
--tp22223747p22223747.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


__________ Information from ESET NOD32 Antivirus, version of virus signature
database 3891 (20090226) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


 

__________ Information from ESET NOD32 Antivirus, version of virus signature
database 3891 (20090226) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 


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


Re: How to copy resource files to target/classes directory?

Posted by David Weintraub <qa...@gmail.com>.
Okay, you know where those resources should be. Why is it so difficult
to move the resource files to their correct directory?  If you are
using a version control system, and worry about moving files that
other users might be working on, do a copy first, then let everyone
get use to the new place. After that, delete them from the
src/main/java directory. The whole process shouldn't take more than a
day or two.

It is possible to tell Maven to tell Maven to copy those resources
from your src/main/java directory. Clovis has given you the solution,
but one of the advantages of Maven is that there's a standard Maven
way everything works. You know where to find the files because of the
standardized directory structure. Let the developers learn the correct
place where resource files should be stored, so they get use to Maven
and use those job skills on their next assignment.

On Thu, Feb 26, 2009 at 8:11 AM, youhaodeyi <yo...@gmail.com> wrote:
>
> I have may XML files in src/main/java directory and its sub directory. When I
> run "mvn compile", these XML files will not be copied to the target/classes
> directory. I know I can put these files in src/main/resources directory but
> it is really hard work for me. How can I let maven do this?
> --
> View this message in context: http://www.nabble.com/How-to-copy-resource-files-to-target-classes-directory--tp22223747p22223747.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
>
>



-- 
--
David Weintraub
qazwart@gmail.com

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


Antwort: How to copy resource files to target/classes directory?

Posted by Cl...@raibau.at.
<resources>
    <resource combine.children="append">
        <directory>${project.build.sourceDirectory}</directory>
        <includes>
           <include>**/*.xml</include>
        </includes>
    </resource>
</resources>

______________________________________
Diese E-Mail kann vertrauliche und geschuetzte Informationen enthalten. Wenn diese E-Mail nicht für Sie bestimmt ist, bitten wir Sie, uns unverzueglich zu informieren und sie zu loeschen. 

This e-mail message may contain information, which is confidential and protected. If you are not the intended recipient of this message, we ask you to inform us immediately and delete the message afterwards.

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