1

I have a Java Maven project. I have some script A stored under src/main/resources folder.

I found that after mvn install, everything under resource folder will be copied to target folder. So here comes my question:

Let's say my script A (a Windows .bat file), when run, will access file B, which is also under src/main/resources, and generate result file C, which I intend to put also under src/main/resources.

And my script A looks like this:

some command  `c:\project\...\src\main\resource\B`

How will Maven run?

will it

  1. run everything (A, B, create C) under src/main/resources, and copy the result to target folder? or

  2. will it copy A, B to target folder and run from there?

If it is 2), should I change my script A to change path of B to target folder?

halfer
  • 19,824
  • 17
  • 99
  • 186
user1559625
  • 2,583
  • 5
  • 37
  • 75

1 Answers1

4

Maven, or the maven-resources-plugin (https://maven.apache.org/plugins/maven-resources-plugin/) will not run your script at all. Its task is to copy resources to the target of your project.

You could utilize the exec-maven-plugin to do this as described [here] (I want to execute shell commands from maven's pom.xml). Note that you should be very careful with system specific assumptions about path and OS specific scripts within you build process.

Community
  • 1
  • 1
DrHopfen
  • 752
  • 3
  • 13