Maven copy one file from the current directory

I am trying to copy one file from the directory where my project is located and move it to a somewhat temporary "dist" directory until it is copied to its final location. It seems that pom knows where the project is located, but he does not like the fact that I do not specify the directory, and when I specify the directory, it says that it cannot be located.

What works here is what is copied:

<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 unpleasant 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 in any case it does not find the current directory.

+4
source share
1 answer

I do not think that you can leave the <directory> element empty in the resource element. If deploy.xml is in the project directory, try

 <directory>${basedir}</directory> 
0
source

Source: https://habr.com/ru/post/1488569/


All Articles