Skip to content

Commit

Permalink
Merge pull request #8 from jamezp/FORGEPLUGINS-105
Browse files Browse the repository at this point in the history
[FORGEPLUGINS-105]
  • Loading branch information
lincolnthree committed Apr 28, 2013
2 parents 1afed77 + e2d1813 commit 5c6496a
Show file tree
Hide file tree
Showing 29 changed files with 2,262 additions and 1,982 deletions.
22 changes: 2 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
<properties>
<version.org.apache.commons.commons-compress>1.4.1</version.org.apache.commons.commons-compress>

<version.org.jboss.as>7.1.1.Final</version.org.jboss.as>
<version.org.jboss.forge.api>1.2.0.Final</version.org.jboss.forge.api>
<version.org.jboss.remoting3>3.2.12.GA</version.org.jboss.remoting3>
<version.org.jboss.as>7.2.0.Final</version.org.jboss.as>
<version.org.jboss.forge.api>1.2.2.Final</version.org.jboss.forge.api>
<version.org.jboss.spec>3.0.2.Final</version.org.jboss.spec>

<version.compiler.plugin>3.0</version.compiler.plugin>
Expand Down Expand Up @@ -74,15 +73,6 @@
<artifactId>jboss-as-cli</artifactId>
<version>${version.org.jboss.as}</version>
</dependency>
<!--
This is only added as remoting 3 has some backwards compatibility issues when deploying to newer releases.
Remove this when AS version aligns the remoting version.
-->
<dependency>
<groupId>org.jboss.remoting3</groupId>
<artifactId>jboss-remoting</artifactId>
<version>${version.org.jboss.remoting3}</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
Expand Down Expand Up @@ -132,14 +122,6 @@
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-cli</artifactId>
</dependency>
<!--
This is only added as remoting 3 has some backwards compatibility issues when deploying to newer releases.
Remove this when AS version aligns the remoting version.
-->
<dependency>
<groupId>org.jboss.remoting3</groupId>
<artifactId>jboss-remoting</artifactId>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
Expand Down
55 changes: 0 additions & 55 deletions src/main/java/org/jboss/as/forge/AS7Facet.java

This file was deleted.

83 changes: 83 additions & 0 deletions src/main/java/org/jboss/as/forge/AS7MavenPluginFacet.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2012, Red Hat, Inc., and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.as.forge;

import java.util.LinkedList;
import javax.inject.Inject;

import org.jboss.as.forge.util.Messages;
import org.jboss.forge.maven.MavenPluginFacet;
import org.jboss.forge.maven.plugins.MavenPlugin;
import org.jboss.forge.maven.plugins.MavenPluginBuilder;
import org.jboss.forge.project.dependencies.Dependency;
import org.jboss.forge.project.dependencies.DependencyBuilder;
import org.jboss.forge.project.facets.BaseFacet;
import org.jboss.forge.project.facets.DependencyFacet;
import org.jboss.forge.project.facets.ResourceFacet;
import org.jboss.forge.shell.Shell;
import org.jboss.forge.shell.plugins.RequiresFacet;

/**
* A simple facet that only adds the maven plugin to the pom.
*
* @author <a href="mailto:jperkins@redhat.com">James R. Perkins</a>
*/
@RequiresFacet({DependencyFacet.class, MavenPluginFacet.class, ResourceFacet.class})
public class AS7MavenPluginFacet extends BaseFacet {

private final Messages messages = Messages.INSTANCE;

@Inject
private Shell shell;

private final DependencyBuilder pluginDependency = DependencyBuilder.create("org.jboss.as.plugins:jboss-as-maven-plugin");

@Override
public boolean install() {
final DependencyBuilder dependency = DependencyBuilder.create(pluginDependency);
final LinkedList<Dependency> versions = new LinkedList<Dependency>(project.getFacet(DependencyFacet.class).resolveAvailableVersions(dependency));
final MavenPluginFacet pluginFacet = project.getFacet(MavenPluginFacet.class);

// Get the version
final Dependency selectedDependency = shell.promptChoiceTyped(messages.getMessage("prompt.maven.plugin.version"), versions, versions.getLast());

if (!pluginFacet.hasPlugin(pluginDependency)) {
// TODO (jrp) consider EAR or multi-module set-up
final MavenPlugin plugin = MavenPluginBuilder.create()
.setDependency(DependencyBuilder.create(pluginDependency).setVersion(selectedDependency
.getVersion()));
pluginFacet.addPlugin(plugin);
}
return project.getFacet(MavenPluginFacet.class).hasPlugin(pluginDependency);
}

@Override
public boolean isInstalled() {
return project.getFacet(MavenPluginFacet.class).hasPlugin(pluginDependency);
}

@Override
public boolean uninstall() {
project.getFacet(MavenPluginFacet.class).removePlugin(pluginDependency);
return true;
}
}
Loading

0 comments on commit 5c6496a

Please sign in to comment.