Java/JPPMavenReadme

= Notes on the JPackage version of Maven2 =

Need for this page
The maven2 version released with JPackage has extensive modifications to ensure that it works smoothly in off-line mode. In order to facilitate easier maintainability, minimal changes have been made, and most have been kept in separate source files rather than patching into maven code. This page documents those changes, and how they can be used for maven-built packages.

Invocation
To invoke maven in jpp mode, simply type  with the   argument if a separate depmap is needed. All options honored by upstream maven are honored by. The command's action is almost the same as  -- only that it supplies   prior to invoking maven.

Dependency Maps
To build a new project for a new rpm, a depmap may need to be created so as to allow finding of the new jars. The point of this tell the build tool where to find the required libraries.

The depmap has entries in the format:

.. OGROUPID OARTIFACTID OVERSION NGROUPID NARTIFACTID NVERSION ..

Where OGROUPID, OARTIFACTID and OVERSION are old group/artifact/versions (as they exist in your project) and NGROUPID, NARTIFACTID, NVERSION are the new ones. For example:

org.codehaus.plexus plexus-ant-factory 1.0 JPP/plexus ant-factory 1.0

The above mapping indicates that if any of the poms need an artifact with  and , it can be found at   Where   is one of the active repositories with layout "jpp" ([#jpp-layout jpp]  is a new layout that has been added to the JPackage Maven2 rpm).

If  is specified (default with , any requirement of   will be satisfied with $REPOSITORY/JPP/plexus/ant-factory.jar regardless of version.

If only a  element is supplied and no , it is assumed that the dependency is to be discarded. For example, some projects depend on the  which has no equivalent jar in JPackage packages as   is just a monolithic jar containing velocity dependencies. To remove  then, you would add: velocity</groupId> velocity-dep</artifactId> 1.4 to the depmap.

There are two system depmaps. An unversioned one is located at:. This is used when  is specified. A versioned one is located at. This is an auto-generated map which is rebuilt each time the  macro is called by an rpm. Finally, a custom one can be specified via

The versionless one contains depmap entries for items whose poms are installed by maven2-common-poms (for now). As time passes, more and more packages will start using the  and   macros and hopefully, the versionless can be phased out completely. If your project needs a mapping that is not already in there, you will have to create a separate file and use it via the above mentioned property.

The custom depmap has highest preference, followed by the versioned depmap, followed by the versionless one.

New properties
The maven2 rpm in Fedora provides the following new properties that can be passed to the  wrapper script.


 * - This property tells maven to use the pre-configured jpackage repositories.
 * - This property tells maven to ignore versions when looking at the dependency map.
 * - With this property supplied, maven will try to use jpackage jars whenever possible. It's main intention is to allow users to use /usr/share/java files when available, and fetch jars from the net if not. It may be combined with the above two.
 * - This option tells maven where to find custom dependency mappings

POM file names
A package should install all the necessary poms that it supplies. Poms are installed to  and their name follows a convention that allows maven to locate them easily. The name of the file should follow the following convention:

, where  is the name of the jar without the   suffix.

For example, for, the jar is  , so the pom would be named  .<BR>For   the jar is  , so the pom would be named.

Packages adding their own depmaps
Packages from now on should add their own depmap fragments when they get installed. This is achieved by calling the  macro for each jar/artifact being installed, followed by calling   in the post and postun sections (note: this means that there will have to be a jpackage-utils post and postun requirement for all packages that do this, since jpackage-utils provides the macros). Finally,  should be added in the %files section of the main package. The idea is as follows:

The %install section of each package uses the  macro for each jar/pom that the main package and it's subpackages install. The macro puts the resulting data in $RPM_BUILD_ROOT%{_mavendepmapfragdir}/%{name}. update_maven_depmap in the post and postun then cat's /etc/maven/fragments/* into /etc/maven/maven2-depmap.xml which is read whenever  is run. See the plexus-cdc spec for a simple example, and maven-doxia for a more complex one.

"jpp" Layout
The JPackage repository layout is a very simple layout. The group id translates to the subdirectory structure inside the repository, and the artifactid denotes the jar name, without the .jar at the end. For example, if  is a repository marked with the "jpp" layout, then   will cause maven to look for

= See Also =
 * Java