You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Alexei Barantsev <ba...@kazbek.ispras.ru> on 2002/12/04 18:35:07 UTC

Projects and dependencies identification and artifact naming (or: On id, groupId and artifactId)

This suggestion is intended to work out uniform scheme of projects and
dependencies identification.

There are two objectives:
1) preserve backward compatibility, and
2) make new usable and flexible scheme

State of art:
-----------------

1) Project identification.
User can specify <id> and <groupId> elements in project descriptor.
<id> is used for artifact naming purposes primarily (together with
<currentVersion>).
<groupId> is used for directory naming where this artifact should be
installed or deployed.

2) Dependency identification.
User can specify <id>, <groupId>, <version> and <type> elements in
dependency specification.
<id>, <groupId> and <version> is used for dependency artifact naming
purposes.
<groupId> is used to specify dependency artifact location (directory).
<type> is used for different purposes and possible values of this
element are not documented.

Suggestion:
-----------------

The main idea is to consider project/dependency identification and
artifact naming separately.

1) Suggestion on new style of dependency declaration is covered in User
Guide
(http://jakarta.apache.org/turbine/maven/reference/user-guide.html#Namin
g Conventions)
<groupId>org.foo.bar</groupId>
<artifactId>foo</artifactId>
<artifactType>jar</artifactType>
<version>1.0</version>
<category>runtime</category>

I suggest to use this declaration scheme and the following
identification and naming schemes:
a) dependency id := <groupId>:<artifactId>
b) artifact name := <artifactId>-<version>.<artifactType>
c) artifact location := <groupId>/<artifactType>/<artifact name defined
in b)>

Backward compatibility: old <id> specification should be interpreted as
following:
(id == ant) <=> ((groupId == ant) && (artifactId == ant)) <=> (id ==
ant:ant)
(id == ant+optional) <=> ((groupId == ant) && (artifactId ==
ant-optional)) <=> (id == ant:ant-optional)
(id == foo:bar) <=> ((groupId == foo) && (artifactId == bar)) <=> (id ==
foo:bar)
One can see that id specification on the right works for old style too.

2) Suggestion on new style of project descriptor:
<groupId>org.foo.bar</groupId>
<artifactId>foo</artifactId>
<artifactType>jar</artifactType>
<version>1.0</version>

This declaration scheme replaces existing <id> and <currentVersion>
elements
in favour of unified style for dependencies and projects. Identification
and naming
schemes exactly as described above for dependencies.

New thing is <artifactType>. It might be used to automatically select
right default goal.
For example, special build goal will call <artifactType>:build goal,
install will call <artifactType>:install, deploy - <artifactType>:deploy
etc.
So right plugin will be selected by <artifactType> - jar:install or
war:install or plugin:install etc.

Now, to specify dependency on some artifact one should use exactly
the same description as the project that creates this artifact.

-- 
Alexei Barantsev, ISP RAS
E-mail: barancev@kazbek.ispras.ru
ICQ   : 3959207