Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FORGE-1077: Moved the forge-maven-plugin to furnace-maven-plugin
- Loading branch information
Showing
8 changed files
with
585 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
== Furnace Maven Plugin project | ||
|
||
=== Summary | ||
|
||
The Furnace Maven Plugin provides a clean Maven integration with Furnace. | ||
You can install addons into a specific repository during build time, thus avoiding the need to store addons JARs in your SCM. | ||
|
||
NOTE: due to https://issues.jboss.org/browse/FORGE-1034, this plugin only runs in Maven 3.1.0 | ||
|
||
=== Install | ||
|
||
Add the following to your pom.xml: | ||
|
||
[source,xml] | ||
---- | ||
<plugin> | ||
<groupId>org.jboss.furnace</groupId> | ||
<artifactId>furnace-maven-plugin</artifactId> | ||
<version>${version.forge}</version> | ||
<executions> | ||
<execution> | ||
<id>deploy-addons</id> | ||
<phase>prepare-package</phase> | ||
<goals> | ||
<goal>addon-install</goal> | ||
</goals> | ||
<inherited>false</inherited> | ||
<configuration> | ||
<addonRepository>${basedir}/addon-repository</addonRepository> | ||
<addonIds> | ||
<addonId>org.jboss.forge:addon-manager,${version.forge}</addonId> | ||
<addonId>org.jboss.forge:maven,${version.forge}</addonId> | ||
<addonId>org.jboss.forge:projects,${version.forge}</addonId> | ||
</addonIds> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.jboss.forge.furnace</groupId> | ||
<artifactId>furnace-manager-resolver-maven</artifactId> | ||
<version>${version.forge}</version> | ||
</dependency> | ||
</dependencies> | ||
</plugin> | ||
---- | ||
|
||
Where: | ||
|
||
version.forge | ||
|
||
is a maven property with the desired forge version (E.g. 2.0.0.Alpha10) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.jboss.forge.furnace</groupId> | ||
<artifactId>furnace-parent</artifactId> | ||
<version>2.0.0-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>furnace-maven-plugin</artifactId> | ||
<packaging>maven-plugin</packaging> | ||
<name>Furnace - Maven Plugin</name> | ||
<url>http://forge.jboss.org</url> | ||
|
||
<prerequisites> | ||
<maven>3.1</maven> | ||
</prerequisites> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<version.maven>3.1.0</version.maven> | ||
</properties> | ||
|
||
<dependencies> | ||
<!-- Maven Dependencies --> | ||
<dependency> | ||
<groupId>org.apache.maven</groupId> | ||
<artifactId>maven-plugin-api</artifactId> | ||
<version>${version.maven}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.maven.plugin-tools</groupId> | ||
<artifactId>maven-plugin-annotations</artifactId> | ||
<version>3.2</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.maven</groupId> | ||
<artifactId>maven-project</artifactId> | ||
<version>3.0-alpha-2</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<!-- Furnace Dependencies --> | ||
<dependency> | ||
<groupId>org.jboss.forge.furnace</groupId> | ||
<artifactId>furnace</artifactId> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jboss.forge.furnace</groupId> | ||
<artifactId>furnace-manager</artifactId> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jboss.forge.furnace</groupId> | ||
<artifactId>furnace-manager-spi</artifactId> | ||
<scope>compile</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-plugin-plugin</artifactId> | ||
<configuration> | ||
<goalPrefix>forge</goalPrefix> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>generated-helpmojo</id> | ||
<goals> | ||
<goal>helpmojo</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>mojo-descriptor</id> | ||
<goals> | ||
<goal>descriptor</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-plugin-plugin</artifactId> | ||
<configuration> | ||
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
</project> |
78 changes: 78 additions & 0 deletions
78
maven-plugin/src/main/java/org/jboss/forge/furnace/maven/plugin/AddonInstallMojo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* Copyright 2013 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Eclipse Public License version 1.0, available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
|
||
package org.jboss.forge.furnace.maven.plugin; | ||
|
||
import java.io.File; | ||
import java.util.Iterator; | ||
import java.util.ServiceLoader; | ||
|
||
import org.apache.maven.plugin.AbstractMojo; | ||
import org.apache.maven.plugin.MojoExecutionException; | ||
import org.apache.maven.plugin.MojoFailureException; | ||
import org.apache.maven.plugins.annotations.LifecyclePhase; | ||
import org.apache.maven.plugins.annotations.Mojo; | ||
import org.apache.maven.plugins.annotations.Parameter; | ||
import org.jboss.forge.furnace.Furnace; | ||
import org.jboss.forge.furnace.addons.AddonId; | ||
import org.jboss.forge.furnace.impl.FurnaceImpl; | ||
import org.jboss.forge.furnace.manager.AddonManager; | ||
import org.jboss.forge.furnace.manager.impl.AddonManagerImpl; | ||
import org.jboss.forge.furnace.manager.request.InstallRequest; | ||
import org.jboss.forge.furnace.manager.spi.AddonDependencyResolver; | ||
import org.jboss.forge.furnace.repositories.AddonRepository; | ||
import org.jboss.forge.furnace.repositories.AddonRepositoryMode; | ||
|
||
/** | ||
* Goal which installs addons to a specified directory | ||
*/ | ||
@Mojo(name = "addon-install", defaultPhase = LifecyclePhase.PREPARE_PACKAGE, threadSafe = true) | ||
public class AddonInstallMojo extends AbstractMojo | ||
{ | ||
|
||
/** | ||
* Addon repository file location | ||
*/ | ||
@Parameter(property = "forge.repository", required = true) | ||
private File addonRepository; | ||
|
||
/** | ||
* Addon IDs to install | ||
*/ | ||
@Parameter(property = "forge.addonIds", required = true) | ||
private String[] addonIds; | ||
|
||
@Override | ||
public void execute() throws MojoExecutionException, MojoFailureException | ||
{ | ||
Furnace forge = new FurnaceImpl(); | ||
if (!addonRepository.exists()) | ||
{ | ||
addonRepository.mkdirs(); | ||
} | ||
AddonRepository repository = forge.addRepository(AddonRepositoryMode.MUTABLE, addonRepository); | ||
Iterator<AddonDependencyResolver> it = ServiceLoader.load(AddonDependencyResolver.class).iterator(); | ||
if (!it.hasNext()) | ||
{ | ||
throw new MojoExecutionException( | ||
"No AddonDependencyResolver implementation found. Please add one in the <dependencies> section of the forge-maven-plugin."); | ||
} | ||
AddonDependencyResolver addonResolver = it.next(); | ||
AddonManager addonManager = new AddonManagerImpl(forge, addonResolver, false); | ||
|
||
for (String addonId : addonIds) | ||
{ | ||
AddonId id = AddonId.fromCoordinates(addonId); | ||
InstallRequest install = addonManager.install(id, repository); | ||
if (!install.getActions().isEmpty()) | ||
{ | ||
getLog().info("" + install); | ||
install.perform(); | ||
} | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
maven-plugin/src/main/java/org/jboss/forge/furnace/maven/plugin/ConfigureAsAddonMojo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright 2013 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Eclipse Public License version 1.0, available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
|
||
package org.jboss.forge.furnace.maven.plugin; | ||
|
||
import org.apache.maven.plugin.AbstractMojo; | ||
import org.apache.maven.plugin.MojoExecutionException; | ||
import org.apache.maven.plugin.MojoFailureException; | ||
import org.apache.maven.plugins.annotations.Component; | ||
import org.apache.maven.plugins.annotations.LifecyclePhase; | ||
import org.apache.maven.plugins.annotations.Mojo; | ||
import org.apache.maven.project.MavenProject; | ||
|
||
@Mojo(name = "addon", defaultPhase = LifecyclePhase.VALIDATE) | ||
public class ConfigureAsAddonMojo extends AbstractMojo | ||
{ | ||
|
||
@Component | ||
MavenProject project; | ||
|
||
@Override | ||
public void execute() throws MojoExecutionException, MojoFailureException | ||
{ | ||
|
||
} | ||
} |
Oops, something went wrong.