Maven plugin to "mavenize" a set of files by generating a pom.xml that attaches these files.
The mvnize-maven-plugin features two goals with the following purposes:
attach: Attaches a file to thepom.xmlin order to prepare it for publishing. The POM is generated if it does not yet exist. Typically, the file extension becomes the Maven type, and the file name the Maven classifier. This goal updates thepom.xmlwith abuild-helper-maven-pluginsection that declares the appropriate file-to-artifact mappings.consume: Reads in apom.xml(typically one generated using theattachgoal) and derives aconsumer.pom.xmlfor consumption. This goal reads thebuild-helper-maven-pluginconfiguration and adds all artifacts as dependencies to theconsumer.pom.xml.
mvn org.aksw.maven.plugins:mvnize-maven-plugin:help Organize a set of files as a Maven project for publishing and
consumption
This plugin has 3 goals:
mvnize:attach
Generate a pom.xml file (if yet absent) and attach a specified file as an
artifact to it.
mvnize:consume
Based on a pom.xml generated by this plugin's "attach" goal, generate a
consumer.pom.xml file which adds all artifacts to its dependencies section.
mvnize:help
Display help information on mvnize-maven-plugin.
Call mvn mvnize:help -Ddetail=true -Dgoal=<goal-name> to display parameter
details.
mvn org.aksw.maven.plugins:mvnize-maven-plugin:attach \
-DparentId=my.org:my-data-deployment-setup:0.0.1 \
-DartifactId=my.org:pokedex-rdf-2023:1:ttl.bz2:data \
-Dfile=pokedex-data-rdf.ttl.bz2Notes:
- The GAV (groupId, artifact, version) of the
artifactIdmust match that of an existingpom.xml. - that Maven does not allow dependencies of multiple versions. So if we want to use datasets that were published at different dates,
its best to encode the publishing data in the artifact name, such as
pokedex-rdf-2023. The version field can then be used to adress fixes of historic data, i.e. the version field refers to changes of data published at that time. Since such changes happen very rarely, a simple sequential id should be sufficient rather than the typical 3-component semantic version.
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>my.org</groupId>
<artifactId>my-data-deployment-setup</artifactId>
<version>0.0.1</version>
</parent>
<groupId>my.org</groupId>
<artifactId>pokedex-rdf-2023</artifactId>
<version>1</version>
<packaging>pom</packaging>
<properties>
<build-helper-maven-plugin.version>3.3.0</build-helper-maven-plugin.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${build-helper-maven-plugin.version}</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>pokedex-data-rdf.ttl.bz2</file>
<type>ttl.bz2</type>
<classifier>data</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
mvn org.aksw.maven.plugins:mvnize-maven-plugin:consumeThere now exists a consumer.pom.xml with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>my-group</groupId>
<artifactId>my-artifact</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>my.org</groupId>
<artifactId>pokedex-rdf-2023</artifactId>
<version>1</version>
<type>ttl.bz2</type>
<classifier>data</classifier>
</dependency>
</dependencies>
</project>