maven-model-jdom-support

CommonJava top-level parent POM.

License

License

Categories

Categories

Maven Build Tools JDOM Business Logic Libraries
GroupId

GroupId

org.commonjava.maven
ArtifactId

ArtifactId

maven3-model-jdom-support
Last Version

Last Version

1.6
Release Date

Release Date

Type

Type

jar
Description

Description

maven-model-jdom-support
CommonJava top-level parent POM.
Source Code Management

Source Code Management

http://github.com/commonjava/maven-model-jdom-support

Download maven3-model-jdom-support

How to add to project

<!-- https://jarcasting.com/artifacts/org.commonjava.maven/maven3-model-jdom-support/ -->
<dependency>
    <groupId>org.commonjava.maven</groupId>
    <artifactId>maven3-model-jdom-support</artifactId>
    <version>1.6</version>
</dependency>
// https://jarcasting.com/artifacts/org.commonjava.maven/maven3-model-jdom-support/
implementation 'org.commonjava.maven:maven3-model-jdom-support:1.6'
// https://jarcasting.com/artifacts/org.commonjava.maven/maven3-model-jdom-support/
implementation ("org.commonjava.maven:maven3-model-jdom-support:1.6")
'org.commonjava.maven:maven3-model-jdom-support:jar:1.6'
<dependency org="org.commonjava.maven" name="maven3-model-jdom-support" rev="1.6">
  <artifact name="maven3-model-jdom-support" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.commonjava.maven', module='maven3-model-jdom-support', version='1.6')
)
libraryDependencies += "org.commonjava.maven" % "maven3-model-jdom-support" % "1.6"
[org.commonjava.maven/maven3-model-jdom-support "1.6"]

Dependencies

compile (6)

Group / Artifact Type Version
org.jdom : jdom2 jar 2.0.6
org.apache.maven : maven-model jar 3.0.3
org.apache.maven : maven-repository-metadata jar 3.0.3
org.apache.maven : maven-settings jar 3.0.3
org.apache.maven : maven-core jar 3.0.3
commons-io : commons-io jar 2.4

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
org.hamcrest : hamcrest-core jar 1.3

Project Modules

There are no modules declared in this project.

JDom Support for Common Maven Models

This project simply extracts the Modello source files from the Apache Maven distribution source zip, and re-runs the Modello Maven plugin on them using the 'jdom-writer' goal. The point of this exercise is to provide a reusable artifact that contains the JDom ModelWriter classes for common models found in Maven. The advantage to the JDom writers is that they can preserve existing order of elements, formatting, and comments.

Currently, this project produces writers for the following models:

  • pom.xml
  • settings.xml
  • toolchains.xml
  • maven-metadata.xml

Example

To write changes to a Maven pom.xml, with formats/comments preserved:

File pom = new File( "pom.xml" );
Writer writer = null;
try
{
    final SAXBuilder builder = new SAXBuilder();
    builder.setIgnoringBoundaryWhitespace( false );
    builder.setIgnoringElementContentWhitespace( false );

    final Document doc = builder.build( pom );

    String encoding = model.getModelEncoding();
    if ( encoding == null )
    {
        encoding = "UTF-8";
    }

    final Format format = Format.getRawFormat().setEncoding( encoding ).setTextMode( TextMode.PRESERVE );

    writer = WriterFactory.newWriter( pom, encoding );

    new MavenJDOMWriter().write( model, doc, writer, format );
}
finally
{
    IOUtil.close( writer );
}

To use this code, you'll have to add the JDom dependency to your project's pom.xml:

<dependency>
  <groupId>org.jdom</groupId>
  <artifactId>jdom</artifactId>
  <version>1.1</version>
</dependency>
org.commonjava.maven

Red Hat NOS

Middleware pipeline content management projects

Versions

Version
1.6
1.5
1.4
1.3.1