org.apache.maven.artifact.handler.manager.ArtifactHandlerManager Java Examples
The following examples show how to use
org.apache.maven.artifact.handler.manager.ArtifactHandlerManager.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DependencyGraphBuilderTest.java From cloud-opensource-java with Apache License 2.0 | 5 votes |
protected void setUp() throws Exception { // required for mojo lookups to work super.setUp(); File testPom = new File( getBasedir(), "target/test-classes/DependencyGraphBuilderTest/DependencyGraphBuilderTest.xml" ); mojo = (DependencyGraphBuilder) lookupMojo( "getBuildingRequest", testPom ); assertNotNull( mojo ); assertNotNull( mojo.getProject() ); MavenProject project = mojo.getProject(); MavenSession session = newMavenSession( project ); setVariableValueToObject( mojo, "session", session ); DefaultRepositorySystemSession repoSession = (DefaultRepositorySystemSession) session.getRepositorySession(); //repoSession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( stubFactory.getWorkingDir() ) ); Artifact artifact = new DefaultArtifact( "org.com.google","artifactId", "1.0.0", "compile", "jar", "C1", null); Set<Artifact> set = new HashSet<Artifact>(); set.add( artifact ); project.setArtifacts( set ); project.setArtifactId( "id" ); ArtifactHandlerManager manager = lookup( ArtifactHandlerManager.class ); setVariableValueToObject( mojo, "artifactHandlerManager", manager ); }
Example #2
Source File: CreateEffectivePomTest.java From flatten-maven-plugin with Apache License 2.0 | 5 votes |
/** * Tests method to create effective POM. * * @throws Exception if something goes wrong. */ @Test public void testCreateEffectivePom() throws Exception { String magicValue = "magic-value"; Properties userProperties = new Properties(); userProperties.setProperty( "cmd.test.property", magicValue ); File pomFile = new File( "src/test/resources/cmdpropertysubstituion/pom.xml" ); ArtifactRepository localRepository = new MavenArtifactRepository(); localRepository.setLayout( new DefaultRepositoryLayout() ); ArtifactFactory artifactFactory = new DefaultArtifactFactory(); ArtifactHandlerManager artifactHandlerManager = new DefaultArtifactHandlerManager(); setDeclaredField( artifactFactory, "artifactHandlerManager", artifactHandlerManager ); Map<String, ArtifactHandler> artifactHandlers = new HashMap<String, ArtifactHandler>(); setDeclaredField( artifactHandlerManager, "artifactHandlers", artifactHandlers ); DefaultDependencyResolver depencencyResolver = new DefaultDependencyResolver(); DefaultProjectBuildingRequest projectBuildingRequest = new DefaultProjectBuildingRequest(); FlattenModelResolver resolver = new FlattenModelResolver( localRepository, artifactFactory, depencencyResolver, projectBuildingRequest, Collections.<MavenProject>emptyList() ); ModelBuildingRequest buildingRequest = new DefaultModelBuildingRequest().setPomFile( pomFile ).setModelResolver( resolver ).setUserProperties( userProperties ); setDeclaredField( tested, "modelBuilderThreadSafetyWorkaround", buildModelBuilderThreadSafetyWorkaroundForTest() ); Model effectivePom = tested.createEffectivePom( buildingRequest, false, FlattenMode.defaults ); assertThat( effectivePom.getName() ).isEqualTo( magicValue ); }
Example #3
Source File: AetherUtils.java From takari-lifecycle with Eclipse Public License 1.0 | 4 votes |
public static ArtifactTypeRegistry newArtifactTypeRegistry(ArtifactHandlerManager handlerManager) { return new MavenArtifactTypeRegistry(handlerManager); }
Example #4
Source File: AetherUtils.java From takari-lifecycle with Eclipse Public License 1.0 | 4 votes |
public MavenArtifactTypeRegistry(ArtifactHandlerManager handlerManager) { this.handlerManager = handlerManager; }