外树使用Maven构建。是否可以? [英] Out-of-tree build with maven. Is it possible?

查看:178
本文介绍了外树使用Maven构建。是否可以?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始学习包装几个发行版(目前Cygwin和Debian的)。

I start learning packaging for several distros (currently Cygwin and Debian).

他们的要求来构建系统,让外树构建(同义词外源构建

They have requirement to build system to allow out-of-tree build (synonym out-of-source build):

http://wiki.debian.org/UpstreamGuide#Out-of-Tree_Builds

要与工作围绕哑巴打造系统为例 cygport 推荐使用 lndir (从 xutils 项目):

To work-around "dumb" build system for example cygport recommend use lndir (from xutils project):


  lndir ${S} ${B}
  cd {B}
  ...build-commands...

我读 MVN(1)手册页,但不会发现任何挪用。接下来,我只是尝试:

I read mvn(1) man page but doesn't found anything appropriated. Next I just try:


  $ mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
  ...
  $ pwd
  /maven/simple
  $ ls 
  my-app
  $ mvn -f my-app/pom.xml compile
  ...
  [INFO] --- maven-compiler-plugin:2.0.2:compile (default-compile) @ my-app ---
  [INFO] Compiling 1 source file to /maven/simple/my-app/target/classes

正如你所看到的目标在源根目录层级中创建,而我寻找一个方法来避免这个目录。

As you can see target directory created in source root hierarchy while I look for a way to avoid this.

有可能的外树用Maven构建?怎么样?

Is it possible out-of-tree build with maven? And how?

推荐答案

这可能是具有这样的简单

It might be as simple as having a

<build>
    <directory>/your/build/directory</directory>
</build>

在你的pom.xml。 /你/编译/目录不必在源树,并可以使用常用的参数化 $ {...} 语法。

in your pom.xml. /your/build/directory need not be in the source tree and can be parameterized using the usual ${...} syntax.

干杯,

这篇关于外树使用Maven构建。是否可以?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆