本文整理汇总了Java中org.apache.maven.execution.DefaultMavenExecutionResult类的典型用法代码示例。如果您正苦于以下问题:Java DefaultMavenExecutionResult类的具体用法?Java DefaultMavenExecutionResult怎么用?Java DefaultMavenExecutionResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultMavenExecutionResult类属于org.apache.maven.execution包,在下文中一共展示了DefaultMavenExecutionResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: readProjectWithDependencies
import org.apache.maven.execution.DefaultMavenExecutionResult; //导入依赖的package包/类
public MavenExecutionResult readProjectWithDependencies(MavenExecutionRequest req, boolean useWorkspaceResolution) {
if (useWorkspaceResolution) {
req.setWorkspaceReader(new NbWorkspaceReader());
}
File pomFile = req.getPom();
MavenExecutionResult result = new DefaultMavenExecutionResult();
try {
ProjectBuildingRequest configuration = req.getProjectBuildingRequest();
configuration.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL);
configuration.setResolveDependencies(true);
configuration.setRepositorySession(maven.newRepositorySession(req));
ProjectBuildingResult projectBuildingResult = projectBuilder.build(pomFile, configuration);
result.setProject(projectBuildingResult.getProject());
result.setDependencyResolutionResult(projectBuildingResult.getDependencyResolutionResult());
} catch (ProjectBuildingException ex) {
//don't add the exception here. this should come out as a build marker, not fill
//the error logs with msgs
return result.addException(ex);
}
normalizePaths(result.getProject());
return result;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:MavenEmbedder.java
示例2: runMavenRequest
import org.apache.maven.execution.DefaultMavenExecutionResult; //导入依赖的package包/类
public void runMavenRequest(MavenExecutionRequest request, Runnable runnable) {
DefaultMaven maven = (DefaultMaven) getMavenComponent(Maven.class);
RepositorySystemSession repositorySystemSession = maven.newRepositorySession(request);
request.getProjectBuildingRequest().setRepositorySession(repositorySystemSession);
MavenSession mavenSession =
new MavenSession(
container, repositorySystemSession, request, new DefaultMavenExecutionResult());
LegacySupport legacySupport = getMavenComponent(LegacySupport.class);
MavenSession previousSession = legacySupport.getSession();
legacySupport.setSession(mavenSession);
try {
for (AbstractMavenLifecycleParticipant participant :
getLifecycleParticipants(Collections.emptyList())) {
participant.afterSessionStart(mavenSession);
}
runnable.run();
} catch (MavenExecutionException e) {
throw new RuntimeException(e);
} finally {
legacySupport.setSession(previousSession);
}
}
开发者ID:eclipse,项目名称:che,代码行数:23,代码来源:MavenServerImpl.java
示例3: newMavenSession
import org.apache.maven.execution.DefaultMavenExecutionResult; //导入依赖的package包/类
@Override
protected MavenSession newMavenSession(MavenProject project) {
MavenExecutionResult result = new DefaultMavenExecutionResult();
MavenSession session = new MavenSession(getContainer(),
project.getProjectBuildingRequest().getRepositorySession(), currentMavenExecutionRequest, result);
session.setCurrentProject(project);
session.setProjects(Arrays.asList(project));
try {
LegacySupport legacySupport = this.lookup(LegacySupport.class);
legacySupport.setSession(session);
} catch (Exception e) {
e.printStackTrace();
}
return session;
}
开发者ID:coastland,项目名称:gsp-dba-maven-plugin,代码行数:19,代码来源:AbstractDdlMojoTest.java
示例4: createUpdateSession
import org.apache.maven.execution.DefaultMavenExecutionResult; //导入依赖的package包/类
private ManipulationSession createUpdateSession() throws Exception
{
ManipulationSession session = new ManipulationSession();
session.setState( new DependencyState( p ) );
session.setState( new VersioningState( p ) );
session.setState( new CommonState( p ) );
final MavenExecutionRequest req =
new DefaultMavenExecutionRequest().setUserProperties( p ).setRemoteRepositories( Collections.<ArtifactRepository>emptyList() );
final PlexusContainer container = new DefaultPlexusContainer();
final MavenSession mavenSession = new MavenSession( container, null, req, new DefaultMavenExecutionResult() );
session.setMavenSession( mavenSession );
return session;
}
开发者ID:release-engineering,项目名称:pom-manipulation-ext,代码行数:19,代码来源:PropertiesUtilsTest.java
示例5: newSession
import org.apache.maven.execution.DefaultMavenExecutionResult; //导入依赖的package包/类
private MavenSession newSession(MavenProject project, File localrepo, Properties properties) throws Exception {
MavenExecutionRequest request = new DefaultMavenExecutionRequest();
MavenExecutionResult result = new DefaultMavenExecutionResult();
DefaultRepositorySystemSession repoSession = MavenRepositorySystemUtils.newSession();
LocalRepository localRepo = new LocalRepository(localrepo);
repoSession.setLocalRepositoryManager(mojos.getContainer().lookup(LocalRepositoryManagerFactory.class, "simple").newInstance(repoSession, localRepo));
MavenSession session = new MavenSession(mojos.getContainer(), repoSession, request, result);
List<MavenProject> projects = new ArrayList<>();
projects.add(project);
for (String module : project.getModules()) {
MavenProject moduleProject = readMavenProject(new File(project.getBasedir(), module), properties);
moduleProject.setParent(project);
projects.add(moduleProject);
}
session.setProjects(projects);
return session;
}
开发者ID:takari,项目名称:takari-lifecycle,代码行数:19,代码来源:InstallDeployTest.java
示例6: setUp
import org.apache.maven.execution.DefaultMavenExecutionResult; //导入依赖的package包/类
@Override
protected void setUp()
throws Exception
{
super.setUp();
artifactFactory = lookup( ArtifactFactory.class);
artifactRepositoryFactory = lookup( ArtifactRepositoryFactory.class );
RepositorySystemSession repoSession = initRepoSession();
MavenSession session =
new MavenSession( getContainer(), repoSession, new DefaultMavenExecutionRequest(),
new DefaultMavenExecutionResult() );
LegacySupport legacySupport = lookup(LegacySupport.class);
legacySupport.setSession( session );
}
开发者ID:gems-uff,项目名称:oceano,代码行数:17,代码来源:AbstractArtifactComponentTestCase.java
示例7: setResult
import org.apache.maven.execution.DefaultMavenExecutionResult; //导入依赖的package包/类
private void setResult(ProjectBuildingResult pbr, Map<File, MavenExecutionResult> results) {
DefaultMavenExecutionResult r = new DefaultMavenExecutionResult();
normalizePaths(pbr.getProject());
r.setProject(pbr.getProject());
r.setDependencyResolutionResult(pbr.getDependencyResolutionResult());
results.put(pbr.getPomFile(), r);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:MavenEmbedder.java
示例8: newMavenSession
import org.apache.maven.execution.DefaultMavenExecutionResult; //导入依赖的package包/类
protected MavenSession newMavenSession() {
try {
MavenExecutionRequest request = new DefaultMavenExecutionRequest();
MavenExecutionResult result = new DefaultMavenExecutionResult();
// populate sensible defaults, including repository basedir and remote repos
MavenExecutionRequestPopulator populator;
populator = getContainer().lookup( MavenExecutionRequestPopulator.class );
populator.populateDefaults( request );
// this is needed to allow java profiles to get resolved; i.e. avoid during project builds:
// [ERROR] Failed to determine Java version for profile java-1.5-detected @ org.apache.commons:commons-parent:22, /Users/alex/.m2/repository/org/apache/commons/commons-parent/22/commons-parent-22.pom, line 909, column 14
request.setSystemProperties( System.getProperties() );
// and this is needed so that the repo session in the maven session
// has a repo manager, and it points at the local repo
// (cf MavenRepositorySystemUtils.newSession() which is what is otherwise done)
DefaultMaven maven = (DefaultMaven) getContainer().lookup( Maven.class );
DefaultRepositorySystemSession repoSession =
(DefaultRepositorySystemSession) maven.newRepositorySession( request );
repoSession.setLocalRepositoryManager(
new SimpleLocalRepositoryManagerFactory().newInstance(repoSession,
new LocalRepository( request.getLocalRepository().getBasedir() ) ));
@SuppressWarnings("deprecation")
MavenSession session = new MavenSession( getContainer(),
repoSession,
request, result );
return session;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
开发者ID:ahgittin,项目名称:license-audit-maven-plugin,代码行数:34,代码来源:BetterAbstractMojoTestCase.java
示例9: setupSession
import org.apache.maven.execution.DefaultMavenExecutionResult; //导入依赖的package包/类
private VersioningState setupSession( final Properties properties, final Map<ProjectRef, String[]> versionMap )
throws Exception
{
final ArtifactRepository ar =
new MavenArtifactRepository( "test", "http://repo.maven.apache.org/maven2", new DefaultRepositoryLayout(),
new ArtifactRepositoryPolicy(), new ArtifactRepositoryPolicy() );
final MavenExecutionRequest req =
new DefaultMavenExecutionRequest().setUserProperties( properties )
.setRemoteRepositories( Arrays.asList( ar ) );
final PlexusContainer container = new DefaultPlexusContainer();
final MavenSession mavenSession = new MavenSession( container, null, req, new DefaultMavenExecutionResult() );
session = new ManipulationSession();
session.setMavenSession( mavenSession );
final VersioningState state = new VersioningState( properties );
session.setState( state );
final Map<String, byte[]> dataMap = new HashMap<>();
if ( versionMap != null && !versionMap.isEmpty() )
{
for ( final Map.Entry<ProjectRef, String[]> entry : versionMap.entrySet() )
{
final String path = toMetadataPath( entry.getKey() );
final byte[] data = setupMetadataVersions( entry.getValue() );
dataMap.put( path, data );
}
}
final Location mdLoc = MavenLocationExpander.EXPANSION_TARGET;
final Transport mdTrans = new StubTransport( dataMap );
modder =
new TestVersionCalculator( new ManipulationSession(), mdLoc, mdTrans, temp.newFolder( "galley-cache" ) );
return state;
}
开发者ID:release-engineering,项目名称:pom-manipulation-ext,代码行数:41,代码来源:VersioningCalculatorTest.java
示例10: setMavenSession
import org.apache.maven.execution.DefaultMavenExecutionResult; //导入依赖的package包/类
private void setMavenSession()
throws Exception
{
final MavenExecutionRequest req =
new DefaultMavenExecutionRequest().setUserProperties( userCliProperties )
.setRemoteRepositories( Collections.<ArtifactRepository> emptyList() );
final PlexusContainer container = new DefaultPlexusContainer();
final MavenSession mavenSession = new MavenSession( container, null, req, new DefaultMavenExecutionResult() );
session.setMavenSession( mavenSession );
}
开发者ID:release-engineering,项目名称:pom-manipulation-ext,代码行数:14,代码来源:DistributionEnforcingManipulatorTest.java
示例11: getMavenSession
import org.apache.maven.execution.DefaultMavenExecutionResult; //导入依赖的package包/类
public static MavenSession getMavenSession()
{
final DefaultMavenExecutionResult defaultMavenExecutionResult = new DefaultMavenExecutionResult();
MavenExecutionRequest mavenExecutionRequest = new DefaultMavenExecutionRequest();
mavenExecutionRequest.setExecutionListener( new AbstractExecutionListener() );
mavenExecutionRequest.setGoals( Arrays.asList( "clean", "aggr", "install" ) );
final MavenSession session = new MavenSession( null, null, mavenExecutionRequest, defaultMavenExecutionResult );
final ProjectDependencyGraphStub dependencyGraphStub = new ProjectDependencyGraphStub();
session.setProjectDependencyGraph( dependencyGraphStub );
session.setProjects( dependencyGraphStub.getSortedProjects() );
return session;
}
开发者ID:gems-uff,项目名称:oceano,代码行数:13,代码来源:ProjectDependencyGraphStub.java
示例12: createMavenSession
import org.apache.maven.execution.DefaultMavenExecutionResult; //导入依赖的package包/类
protected MavenSession createMavenSession( File pom, Properties executionProperties )
throws Exception
{
MavenExecutionRequest request = createMavenExecutionRequest( pom );
ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest()
.setLocalRepository( request.getLocalRepository() )
.setRemoteRepositories( request.getRemoteRepositories() )
.setPluginArtifactRepositories( request.getPluginArtifactRepositories() )
.setSystemProperties( executionProperties );
MavenProject project = null;
if ( pom != null )
{
project = projectBuilder.build( pom, configuration ).getProject();
}
else
{
project = createStubMavenProject();
project.setRemoteArtifactRepositories( request.getRemoteRepositories() );
project.setPluginArtifactRepositories( request.getPluginArtifactRepositories() );
}
initRepoSession( configuration );
MavenSession session =
new MavenSession( getContainer(), configuration.getRepositorySession(), request,
new DefaultMavenExecutionResult() );
session.setProjects( Arrays.asList( project ) );
return session;
}
开发者ID:gems-uff,项目名称:oceano,代码行数:34,代码来源:AbstractCoreMavenComponentTestCase.java
示例13: createSession
import org.apache.maven.execution.DefaultMavenExecutionResult; //导入依赖的package包/类
@SuppressWarnings( "deprecation" )
private static MavenSession createSession( PlexusContainer container, ArtifactRepository repo, Properties properties )
throws CycleDetectedException, DuplicateProjectException
{
MavenExecutionRequest request = new DefaultMavenExecutionRequest()
.setSystemProperties( properties )
.setGoals( Collections.<String>emptyList() )
.setBaseDirectory( new File( "" ) )
.setLocalRepository( repo );
return new MavenSession( container, request, new DefaultMavenExecutionResult(), Collections.<MavenProject>emptyList() );
}
开发者ID:gems-uff,项目名称:oceano,代码行数:13,代码来源:PluginParameterExpressionEvaluatorTest.java
示例14: testThatASystemScopedDependencyIsNotResolvedFromRepositories
import org.apache.maven.execution.DefaultMavenExecutionResult; //导入依赖的package包/类
public void testThatASystemScopedDependencyIsNotResolvedFromRepositories()
throws Exception
{
//
// We should get a whole slew of dependencies resolving this artifact transitively
//
Dependency d = new Dependency();
d.setGroupId( "org.apache.maven.its" );
d.setArtifactId( "b" );
d.setVersion( "0.1" );
d.setScope( Artifact.SCOPE_COMPILE );
Artifact artifact = repositorySystem.createDependencyArtifact( d );
ArtifactResolutionRequest request = new ArtifactResolutionRequest()
.setArtifact( artifact )
.setResolveRoot( true )
.setResolveTransitively( true )
.setRemoteRepositories( getRemoteRepositories() )
.setLocalRepository( getLocalRepository() );
DefaultRepositorySystemSession session = new DefaultRepositorySystemSession();
session.setLocalRepositoryManager( new SimpleLocalRepositoryManager( request.getLocalRepository().getBasedir() ) );
LegacySupport legacySupport = lookup( LegacySupport.class );
legacySupport.setSession( new MavenSession( getContainer(), session, new DefaultMavenExecutionRequest(),
new DefaultMavenExecutionResult() ) );
ArtifactResolutionResult result = repositorySystem.resolve( request );
resolutionErrorHandler.throwErrors( request, result );
assertEquals( 2, result.getArtifacts().size() );
//
// System scoped version which should
//
d.setScope( Artifact.SCOPE_SYSTEM );
File file = new File( getBasedir(), "src/test/repository-system/maven-core-2.1.0.jar" );
assertTrue( file.exists() );
d.setSystemPath( file.getCanonicalPath() );
artifact = repositorySystem.createDependencyArtifact( d );
//
// The request has not set any local or remote repositories as the system scoped dependency being resolved should only
// give us the dependency off the disk and nothing more.
//
request = new ArtifactResolutionRequest()
.setArtifact( artifact )
.setResolveRoot( true )
.setResolveTransitively( true );
result = repositorySystem.resolve( request );
resolutionErrorHandler.throwErrors( request, result );
assertEquals( 1, result.getArtifacts().size() );
//
// Put in a bogus file to make sure missing files cause the resolution to fail.
//
file = new File( getBasedir(), "src/test/repository-system/maven-monkey-2.1.0.jar" );
assertFalse( file.exists() );
d.setSystemPath( file.getCanonicalPath() );
artifact = repositorySystem.createDependencyArtifact( d );
//
// The request has not set any local or remote repositories as the system scoped dependency being resolved should only
// give us the dependency off the disk and nothing more.
//
request = new ArtifactResolutionRequest()
.setArtifact( artifact )
.setResolveRoot( true )
.setResolveTransitively( true );
try
{
result = repositorySystem.resolve( request );
resolutionErrorHandler.throwErrors( request, result );
}
catch( Exception e )
{
assertTrue( result.hasMissingArtifacts() );
}
}
开发者ID:gems-uff,项目名称:oceano,代码行数:81,代码来源:LegacyRepositorySystemTest.java
示例15: createBuildContext
import org.apache.maven.execution.DefaultMavenExecutionResult; //导入依赖的package包/类
private ReactorContext createBuildContext( MavenSession session )
{
MavenExecutionResult mavenExecutionResult = new DefaultMavenExecutionResult();
ReactorBuildStatus reactorBuildStatus = new ReactorBuildStatus( session.getProjectDependencyGraph() );
return new ReactorContext( mavenExecutionResult, null, null, reactorBuildStatus );
}
开发者ID:gems-uff,项目名称:oceano,代码行数:7,代码来源:LifecycleWeaveBuilderTest.java
注:本文中的org.apache.maven.execution.DefaultMavenExecutionResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论