Search code examples
javamavenpom.xmltarget

Maven: Move Executable (.exe) into target Folder when Compiling


So I tried differnt things to copy my desired, necesarry .exe file into the target folder when compiling my project. I also checked at the Q&A of Move a text file into target folder when compiling a Maven project - but it did not help.

So what I want is to copy 'chromedriver.exe' to the target folder when compiling the project (with mvn clean install). I need this .exe to launch my jar file.

Any help is appreciated!

enter image description here


Solution

  • I found an own solution: in the pom.xml, include

    <resources>
        <resource>
            <directory>${project.basedir}</directory>
            <targetPath>${project.build.directory}</targetPath>
            <includes>
                <include>chromedriver.exe</include>
            </includes>
        </resource> 
    </resources>
    

    under the build tag.