开发者

Maven Basic Question

mvn -DgroupId=org.epseelon.samples -DartifactId=todolist archetype:create

Can anyone explain me the command here.

  1. What is DgroupID?
  2. What is org.epseelon.samples
  3. What is Dartif开发者_开发技巧actID = todolist
  4. What is archetype and create.


The tokens in this command line are:

  • mvn
  • -D
  • groupId
  • =
  • org.epseelon.samples
  • -D
  • artifactId
  • =
  • todolist
  • archetype:create

And here is the explanation:

  • The -D means define a property of the given name, which is very generic. Almost everything can be handled and configured by it.
  • groupId is the namespace in which your projects live. You should choose your own internet domain for it, in reversed order. For example, I usually choose de.roland_illig.*, replacing the * with the actual project name. This will lead to (redundant) complete artifact names like de.roland_illig.todolist:todolist but is useful if I later decide to split the project into several small libraries.
  • artifactId is the project name itself. When you build a .jar file, the resulting file will have this name.
  • archetype is the name of a Maven plug-in.
  • create is an action that is defined by that plug-in.


See the Getting started manual

  • archetype:create is to create a project
  • -DgroupId defines the group usually the domain e.g. org.eclipse.visualedit as a group of artifacts, the it could have a model, a gui and some other modules packed
  • -DartifactId defines the artifact (e.g. a jar file) e.g. visedit-gui-1.0.jar which is one the element of the group.


In maven link text you define dependency on other packages/libraries with 3 parameters: groupId:artifactId:version. For details see documentation. Packages are stored in central repository.

Maven is also known for plugins. Witch archetype:create you call plugin archetype and it's action create (documentation).

The command mvn ... creates a new project based on specified jar org.epseelon.samples:todolist.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜