Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven copy single file from current directory

Tags:

copy

maven

I'm trying to copy a single file from the directory that my project is in and move it to a somewhat temporary "dist" directory until it can be copied to its final location. The pom seems to know where the project is located but it doesn't like the fact that I don't specify a directory and when I do specify the directory, it says it cannot be located.

Here's what works as far as copying goes:

<id>copy-resources-rdeska</id>
<phase>site</phase>
<goals>
    <goal>copy-resources</goal>
</goals>
<configuration>
    <overwrite>true</overwrite>
    <outputDirectory>${dist.dir}/rdesk</outputDirectory>
    <resources>
        <resource>
            <directory>/rdesk</directory>
            <filtering>false</filtering>
            <includes>
                <include>**/*</include>
            </includes>
            <excludes>
                <exclude>**/*.svn</exclude>
                <exclude>**/webapp/*</exclude>
                <exclude>/contact_ejb_default/</exclude> 
            </excludes>
        </resource>
    </resources>
</configuration>

This is one of many, but the troublesome one looks like this:

<id>copy-resources-deploy</id>
<phase>site</phase>
<goals>
    <goal>copy-resources</goal>
</goals>
<configuration>
    <overwrite>true</overwrite>
    <outputDirectory>${dist.dir}/deploy</outputDirectory>
    <resources>
        <resource>
            <directory></directory>
            <filtering>false</filtering>
            <includes>
                <include>deploy.xml</include>
            </includes>
        </resource>
    </resources>
</configuration>

The biggest difference is that I am trying to copy a single file, but either way it is not finding the current directory.

like image 493
user2529494 Avatar asked Jun 27 '13 19:06

user2529494


1 Answers

I don't think you can leave the <directory> element empty in a resource element. If the deploy.xml file is in the project directory, try

<directory>${basedir}</directory>
like image 55
user944849 Avatar answered Nov 08 '22 05:11

user944849