This page (revision-48) was last changed on 28-Jul-2015 06:43 by Dieter Käppel

This page was created on 02-Jun-2009 22:02 by Dieter Käppel

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Page revision history

Version Date Modified Size Author Changes ... Change note
48 28-Jul-2015 06:43 16 KB Dieter Käppel to previous
47 28-Jul-2015 06:43 16 KB Dieter Käppel to previous | to last
46 13-Apr-2015 18:43 15 KB Dieter Käppel to previous | to last
45 14-Mar-2014 23:25 15 KB Dieter Käppel to previous | to last
44 02-Mar-2014 16:05 15 KB Dieter Käppel to previous | to last
43 15-Oct-2013 08:07 14 KB Dieter Käppel to previous | to last
42 09-Aug-2013 04:32 14 KB Dieter Käppel to previous | to last
41 17-May-2013 10:26 13 KB Dieter Käppel to previous | to last

Page References

Incoming links Outgoing links

Version management

Difference between version and

At line 308 added 95 lines
!Eigenes Plugin
Maven-Projekt das ein Artifakt zum Verwenden als Plugin erzeugt:
{{{
<project>
...
<packaging>maven-plugin</packaging>
...
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.sonatype.plexus</groupId>
<artifactId>plexus-build-api</artifactId>
<version>0.0.7</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>1.5.8</version>
</dependency>
...
</dependencies>
...
</project>
}}}
Anlegen eines sogenannten Mojos (Maven-Pojo). Parameter können statisch mit defaults, aus Maven-Parametern durch Expressions oder aus der Plugin-Konfiguration injeziert werden.
{{{
/**
* @goal encode
* @phase generate-resources
*/
public class EncodingMojo extends AbstractMojo {
/*
* @parameter default-value="src/main/resources"
*/
protected File src;
/**
* @parameter expression="${project}"
* @readonly
*/
protected MavenProject project;
/**
* @parameter
* @required
*/
protected Resource resource;
/** @component */
private BuildContext buildContext;
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
...
}
...
}
}}}
Bei Verwendung in Eclipse ab Indigo wird das Maven-Plugin von Eclipse selbst geliefert (M2E). Dies erfordert eine erweiterte Konfiguration des Plugins, da es sonst zu Fehlern im Lifecycle kommt. Dazu wird eine Datei angelegt /<project>/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml
{{{
<?xml version="1.0" encoding="UTF-8"?>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<goals>
<goal>generate-schema</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute>
<runOnIncremental>false</runOnIncremental>
<runOnConfiguration>true</runOnConfiguration>
</execute>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
}}}