-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
05bd7d0
commit 96df7d3
Showing
17 changed files
with
646 additions
and
207 deletions.
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
19 changes: 19 additions & 0 deletions
19
maven/api/src/main/java/org/jboss/forge/addon/maven/projects/MavenBuildSystem.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,19 @@ | ||
/* | ||
* 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.addon.maven.projects; | ||
|
||
import org.jboss.forge.addon.projects.BuildSystem; | ||
|
||
/** | ||
* Marker interface for the Maven {@link BuildSystem}. | ||
* | ||
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a> | ||
* | ||
*/ | ||
public interface MavenBuildSystem extends BuildSystem | ||
{ | ||
} |
152 changes: 152 additions & 0 deletions
152
...mpl-projects/src/main/java/org/jboss/forge/addon/maven/projects/MavenBuildSystemImpl.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,152 @@ | ||
/* | ||
* Copyright 2012 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.addon.maven.projects; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
import java.util.concurrent.Callable; | ||
import java.util.logging.Level; | ||
import java.util.logging.Logger; | ||
|
||
import javax.inject.Inject; | ||
|
||
import org.jboss.forge.addon.facets.Facet; | ||
import org.jboss.forge.addon.facets.FacetFactory; | ||
import org.jboss.forge.addon.maven.projects.facets.MavenDependencyFacet; | ||
import org.jboss.forge.addon.maven.projects.facets.MavenMetadataFacet; | ||
import org.jboss.forge.addon.maven.projects.facets.MavenPackagingFacet; | ||
import org.jboss.forge.addon.maven.projects.facets.MavenResourceFacet; | ||
import org.jboss.forge.addon.maven.projects.facets.MavenWebResourcesFacet; | ||
import org.jboss.forge.addon.parser.java.facets.JavaCompilerFacet; | ||
import org.jboss.forge.addon.parser.java.facets.JavaSourceFacet; | ||
import org.jboss.forge.addon.projects.Project; | ||
import org.jboss.forge.addon.projects.facets.DependencyFacet; | ||
import org.jboss.forge.addon.projects.facets.MetadataFacet; | ||
import org.jboss.forge.addon.projects.facets.PackagingFacet; | ||
import org.jboss.forge.addon.projects.facets.ResourcesFacet; | ||
import org.jboss.forge.addon.projects.facets.WebResourcesFacet; | ||
import org.jboss.forge.addon.resource.DirectoryResource; | ||
import org.jboss.forge.addon.resource.FileResource; | ||
import org.jboss.forge.addon.resource.Resource; | ||
|
||
/** | ||
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a> | ||
*/ | ||
public class MavenBuildSystemImpl implements MavenBuildSystem | ||
{ | ||
private static final Logger log = Logger.getLogger(MavenBuildSystemImpl.class.getName()); | ||
|
||
@Inject | ||
private FacetFactory factory; | ||
|
||
@Override | ||
public String getType() | ||
{ | ||
return "Maven"; | ||
} | ||
|
||
@Override | ||
public Project createProject(final DirectoryResource dir) | ||
{ | ||
Project project = new MavenProject(dir); | ||
|
||
try | ||
{ | ||
factory.install(project, MavenFacetImpl.class); | ||
factory.install(project, MavenPluginFacet.class); | ||
factory.install(project, MavenMetadataFacet.class); | ||
factory.install(project, MavenPackagingFacet.class); | ||
factory.install(project, MavenDependencyFacet.class); | ||
factory.install(project, MavenResourceFacet.class); | ||
try | ||
{ | ||
factory.register(project, MavenWebResourcesFacet.class); | ||
} | ||
catch (IllegalStateException e) | ||
{ | ||
log.log(Level.FINE, "Could not install [" + MavenWebResourcesFacet.class.getName() + "] into project [" | ||
+ project + "]", e); | ||
} | ||
} | ||
catch (RuntimeException e) | ||
{ | ||
throw new IllegalStateException("Could not install Maven into Project located at [" | ||
+ dir.getFullyQualifiedName() + "]", e); | ||
} | ||
|
||
return project; | ||
} | ||
|
||
@Override | ||
public boolean containsProject(final DirectoryResource dir) | ||
{ | ||
Resource<?> pom = dir.getChild("pom.xml"); | ||
return pom.exists() && pom instanceof FileResource; | ||
} | ||
|
||
@Override | ||
public Set<Class<? extends Facet<?>>> getProvidedFacetTypes() | ||
{ | ||
Set<Class<? extends Facet<?>>> result = new HashSet<Class<? extends Facet<?>>>(); | ||
result.add(MavenFacet.class); | ||
result.add(MavenPluginFacet.class); | ||
result.add(DependencyFacet.class); | ||
result.add(MetadataFacet.class); | ||
result.add(PackagingFacet.class); | ||
result.add(ResourcesFacet.class); | ||
|
||
addSafe(result, new Callable<Class<? extends Facet<?>>>() | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
lincolnthree
Author
Member
|
||
{ | ||
@Override | ||
public Class<? extends Facet<?>> call() throws Exception | ||
{ | ||
return WebResourcesFacet.class; | ||
} | ||
}); | ||
addSafe(result, new Callable<Class<? extends Facet<?>>>() | ||
{ | ||
@Override | ||
public Class<? extends Facet<?>> call() throws Exception | ||
{ | ||
return JavaCompilerFacet.class; | ||
} | ||
}); | ||
addSafe(result, new Callable<Class<? extends Facet<?>>>() | ||
{ | ||
@Override | ||
public Class<? extends Facet<?>> call() throws Exception | ||
{ | ||
return JavaSourceFacet.class; | ||
} | ||
}); | ||
return result; | ||
} | ||
|
||
private void addSafe(Set<Class<? extends Facet<?>>> result, Callable<Class<? extends Facet<?>>> callable) | ||
{ | ||
try | ||
{ | ||
Class<? extends Facet<?>> facetType = callable.call(); | ||
if (facetType != null) | ||
result.add(facetType); | ||
} | ||
catch (NoClassDefFoundError e) | ||
{ | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
gastaldi
via email
Member
|
||
} | ||
catch (ClassNotFoundException e) | ||
{ | ||
} | ||
catch (RuntimeException e) | ||
{ | ||
throw e; | ||
} | ||
catch (Exception e) | ||
{ | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |
75 changes: 0 additions & 75 deletions
75
...impl-projects/src/main/java/org/jboss/forge/addon/maven/projects/MavenProjectLocator.java
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.
Why is this method needed?