简体   繁体   中英

Change output directory for maven2

I am creating my first maven2 project and i cant find anything on this by googling.

Can you tell me how to change the default output directory away from "target" I want to be able to name the directory myself.

when i change the build paths for the project and modules in intellij settings, the target folder is still created - although empty. I want it gone for good please :)

Regards

If you are executing maven via command line, you can add following profile in your pom.xml file:

    <profile>
        <id>customOutput</id>
        <build>
            <directory>/your/directory/path/</directory>
        </build>
    </profile>

and can then execute

mvn compile -PcustomOutput

If you want Intellij Idea to handle, you can do by:

File -> Project Structure -> Modules -> Paths

Select Use module compile output path :

Then input the custom paths.

In file / settings / build. Execution, Deployment / Compiler file / settings / build. Execution, Deployment / Compiler there is a point AnnotationProcessors this is where the target folder was being created from. By turning this off, since i wasnt using it, i got the wanted output when building.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM