简体   繁体   English

更改maven2的输出目录

[英]Change output directory for maven2

I am creating my first maven2 project and i cant find anything on this by googling. 我正在创建我的第一个maven2项目,但是通过谷歌搜索找不到任何东西。

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. 当我在intellij设置中更改项目和模块的构建路径时,仍创建目标文件夹-尽管为空。 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: 如果通过命令行执行maven,则可以在pom.xml文件中添加以下配置文件:

    <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: 如果您想处理Intellij Idea,可以通过以下方法进行:

File -> Project Structure -> Modules -> Paths 文件->项目结构->模块->路径

Select Use module compile output path : 选择Use module compile output path

Then input the custom paths. 然后输入自定义路径。

In file / settings / build. Execution, Deployment / Compiler 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. file / settings / build. Execution, Deployment / Compiler有一个点AnnotationProcessors这是从中创建target文件夹的位置。 By turning this off, since i wasnt using it, i got the wanted output when building. 通过关闭此功能,由于我没有使用它,因此在构建时得到了所需的输出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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