Skip to content

Commit

Permalink
o adding atom support by default for Dhanji
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason van Zyl committed Aug 26, 2011
1 parent 4b7cfc9 commit 7781598
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 2 deletions.
4 changes: 3 additions & 1 deletion apache-maven/pom.xml
Expand Up @@ -99,7 +99,9 @@
<artifacts>
<artifact>org.apache.maven:maven-embedder</artifact>
<artifact>org.apache.maven.wagon:wagon-file</artifact>
<artifact>org.sonatype.aether:aether-connector-file</artifact>
<artifact>org.sonatype.aether:aether-connector-file</artifact>
<artifact>org.eclipse.tesla.polyglot:tesla-polyglot-common</artifact>
<artifact>org.eclipse.tesla.polyglot:tesla-polyglot-atom</artifact>
</artifacts>
<excludes>
<exclude>org.codehaus.plexus:plexus-classworlds</exclude>
Expand Down
1 change: 1 addition & 0 deletions apache-maven/src/bin/.gitattributes
@@ -1,4 +1,5 @@
mvn eol=lf crlf=input
pmvn eol=lf crlf=input
mvnDebug eol=lf crlf=input
tsh eol=lf crlf=input
tshd eol=lf crlf=input
Expand Down
1 change: 1 addition & 0 deletions apache-maven/src/main/assembly/bin.xml
Expand Up @@ -47,6 +47,7 @@ under the License.
<include>mvn</include>
<include>tsh</include>
<include>tshd</include>
<include>pmvn</include>
<include>mvnDebug</include>
<!-- This is so that CI systems can periodically run the profiler -->
<include>mvnyjp</include>
Expand Down
1 change: 1 addition & 0 deletions build.xml
Expand Up @@ -299,6 +299,7 @@ This goal just validates the presence of that distribution.
<include name="mvn" />
<include name="tsh" />
<include name="tshd" />
<include name="pmvn" />
</fileset>
</chmod>
</target>
Expand Down
Expand Up @@ -426,7 +426,7 @@ protected void configure()
executionRequestPopulator = container.lookup( MavenExecutionRequestPopulator.class );

modelProcessor = createModelProcessor( container );

settingsBuilder = container.lookup( SettingsBuilder.class );

dispatcher = (DefaultSecDispatcher) container.lookup( SecDispatcher.class, "maven" );
Expand Down Expand Up @@ -679,6 +679,7 @@ private void logSummary( ExceptionSummary summary, Map<String, String> reference
protected ModelProcessor createModelProcessor( PlexusContainer container )
throws ComponentLookupException
{
System.out.println("MavenCli");
return container.lookup( ModelProcessor.class );
}

Expand Down
@@ -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 ) );
}
}
5 changes: 5 additions & 0 deletions pom.xml
Expand Up @@ -544,6 +544,11 @@
<artifactId>tesla-polyglot-common</artifactId>
<version>${mavenVersion}</version>
</dependency>
<dependency>
<groupId>org.eclipse.tesla.polyglot</groupId>
<artifactId>tesla-polyglot-atom</artifactId>
<version>${mavenVersion}</version>
</dependency>
<!--bootstrap-end-comment-->
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
9 changes: 9 additions & 0 deletions tesla-polyglot/pom.xml
Expand Up @@ -25,4 +25,13 @@
<module>tesla-polyglot-common</module>
<module>tesla-polyglot-atom</module>
</modules>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-metadata</artifactId>
</plugin>
</plugins>
</build>
</project>

0 comments on commit 7781598

Please sign in to comment.