forked from olamy/tesla
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
o adding atom support by default for Dhanji
- Loading branch information
Jason van Zyl
committed
Aug 26, 2011
1 parent
4b7cfc9
commit 7781598
Showing
8 changed files
with
85 additions
and
2 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
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
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
63 changes: 63 additions & 0 deletions
63
maven-embedder/src/main/java/org/apache/maven/cli/PolyglotMavenCli.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,63 @@ | ||
package org.apache.maven.cli; | ||
|
||
import org.apache.maven.model.building.ModelProcessor; | ||
import org.codehaus.plexus.PlexusContainer; | ||
import org.codehaus.plexus.classworlds.ClassWorld; | ||
import org.codehaus.plexus.component.composition.CycleDetectedInComponentGraphException; | ||
import org.codehaus.plexus.component.repository.ComponentDescriptor; | ||
import org.codehaus.plexus.component.repository.ComponentRequirement; | ||
import org.codehaus.plexus.component.repository.exception.ComponentLookupException; | ||
|
||
public class PolyglotMavenCli | ||
extends MavenCli | ||
{ | ||
@Override | ||
protected void customizeContainer( final PlexusContainer container ) | ||
{ | ||
assert container != null; | ||
|
||
// HACK: Wedge our processor in as the default | ||
ComponentDescriptor<?> source = container.getComponentDescriptor( ModelProcessor.class.getName(), "polyglot" ); | ||
ComponentDescriptor<?> target = container.getComponentDescriptor( ModelProcessor.class.getName(), "default" ); | ||
target.setImplementation( source.getImplementation() ); | ||
|
||
// delete the old requirements and replace them with the new | ||
// with size == 0 is getRequirements is an emptyList which is immutable | ||
if ( target.getRequirements().size() > 0 ) | ||
{ | ||
target.getRequirements().clear(); | ||
} | ||
for ( ComponentRequirement requirement : source.getRequirements() ) | ||
{ | ||
target.addRequirement( requirement ); | ||
} | ||
|
||
// TODO this should not be needed | ||
ComponentRequirement manager = new ComponentRequirement(); | ||
manager.setFieldName( "manager" ); | ||
manager.setRole( "org.sonatype.maven.polyglot.PolyglotModelManager" ); | ||
manager.setRoleHint( "default" ); | ||
target.addRequirement( manager ); | ||
|
||
try | ||
{ | ||
container.addComponentDescriptor( target ); | ||
} | ||
catch ( final CycleDetectedInComponentGraphException e ) | ||
{ | ||
throw new RuntimeException( e ); | ||
} | ||
} | ||
|
||
public static void main( String[] args ) | ||
{ | ||
final int result = main( args, null ); | ||
System.exit( result ); | ||
} | ||
|
||
public static int main( String[] args, ClassWorld classWorld ) | ||
{ | ||
PolyglotMavenCli cli = new PolyglotMavenCli(); | ||
return cli.doMain( new CliRequest( args, classWorld ) ); | ||
} | ||
} |
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