为什么Maven目标目录是这样调用的?

时间:2013-01-14 14:09:30

标签: maven build naming-conventions

在Maven目标目录中,保存构建的所有输出。许多其他构建系统(如sbt,scala构建工具)也遵循此约定。

出现的问题是"为什么目标目录被调用?"。是因为这个目录是'目标'构建过程或什么?

2 个答案:

答案 0 :(得分:1)

我的猜测是目标目录中会发生很多不同的事情,而不仅仅是构建。例如,如果您执行mvn jetty:运行它会使用目标中的类和maven项目中的文件运行jetty Web服务器。

答案 1 :(得分:1)

我认为目标已被用作计算机科学中各种创造性动作的目标文件夹已有一段时间了。许多linux命令的文档都使用了这个术语。由于大多数构建都在复制文件或创建文件夹,因此它的命名法类似于这些命令是有道理的。

从mv信息页面:

The mv command is used to rename and move files and directories. Its general syntax is:

mv [options] argument(s)

The arguments are names of files and directories. If two file names are provided as arguments, mv renames the first as the second. If a list of arguments is provided and the final argument in the sequence is the name of an existing directory, mv moves all of the other items into that directory. If the final argument is not an existing directory and more than two arguments are provided, an error message is returned.

mv's syntax can also be expressed in a less general form as:

mv [options] source target

If the target file is located in the same directory as the source file, then the source file can only be renamed. If both are in different directories, then the source file is moved to the directory named in the target argument, in which it can keep its original name or be assigned a new name. If the target is a directory, then the source file or directory is moved into that directory and retains its original name.