mirror of https://github.com/apache/maven.git
parent
2a7a7637ca
commit
822504183a
|
@ -107,6 +107,7 @@ public class IntegrationTestSuite
|
||||||
// -------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------
|
||||||
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
|
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
|
||||||
|
|
||||||
|
suite.addTestSuite( MavenITmng6972AllowAccessToGraphPackageTest.class );
|
||||||
suite.addTestSuite( MavenITmng5760ResumeFeatureTest.class );
|
suite.addTestSuite( MavenITmng5760ResumeFeatureTest.class );
|
||||||
suite.addTestSuite( MavenITmng6656BuildConsumer.class );
|
suite.addTestSuite( MavenITmng6656BuildConsumer.class );
|
||||||
suite.addTestSuite( MavenITmng6562WarnDefaultBindings.class );
|
suite.addTestSuite( MavenITmng6562WarnDefaultBindings.class );
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
package org.apache.maven.it;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a test for <a href="https://issues.apache.org/jira/browse/MNG-6972">MNG-6972</a>.
|
||||||
|
*/
|
||||||
|
public class MavenITmng6972AllowAccessToGraphPackageTest
|
||||||
|
extends AbstractMavenIntegrationTestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
public MavenITmng6972AllowAccessToGraphPackageTest()
|
||||||
|
{
|
||||||
|
super( "[3.7.0,)" );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testitMNG6972()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
// The testdir is computed from the location of this file.
|
||||||
|
final File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6972-allow-access-to-graph-package" );
|
||||||
|
|
||||||
|
Verifier verifier;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We must first make sure that any artifact created
|
||||||
|
* by this test has been removed from the local
|
||||||
|
* repository. Failing to do this could cause
|
||||||
|
* unstable test results. Fortunately, the verifier
|
||||||
|
* makes it easy to do this.
|
||||||
|
*/
|
||||||
|
verifier = new Verifier( testDir.getAbsolutePath() );
|
||||||
|
verifier.deleteArtifact( "mng-6972-allow-access-to-graph-package", "build-plugin", "1.0", "jar" );
|
||||||
|
verifier.deleteArtifact( "mng-6972-allow-access-to-graph-package", "using-module", "1.0", "jar" );
|
||||||
|
|
||||||
|
verifier = new Verifier( new File( testDir.getAbsolutePath(), "build-plugin" ).getAbsolutePath() );
|
||||||
|
verifier.getSystemProperties().put( "maven.multiModuleProjectDirectory", testDir.getAbsolutePath() );
|
||||||
|
verifier.executeGoal( "install" );
|
||||||
|
verifier.verifyErrorFreeLog();
|
||||||
|
verifier.resetStreams();
|
||||||
|
|
||||||
|
verifier = new Verifier( new File( testDir.getAbsolutePath(), "using-module" ).getAbsolutePath() );
|
||||||
|
verifier.getSystemProperties().put( "maven.multiModuleProjectDirectory", testDir.getAbsolutePath() );
|
||||||
|
verifier.executeGoal( "install" );
|
||||||
|
verifier.verifyErrorFreeLog();
|
||||||
|
verifier.resetStreams();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
or more contributor license agreements. See the NOTICE file
|
||||||
|
distributed with this work for additional information
|
||||||
|
regarding copyright ownership. The ASF licenses this file
|
||||||
|
to you under the Apache License, Version 2.0 (the
|
||||||
|
"License"); you may not use this file except in compliance
|
||||||
|
with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing,
|
||||||
|
software distributed under the License is distributed on an
|
||||||
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
KIND, either express or implied. See the License for the
|
||||||
|
specific language governing permissions and limitations
|
||||||
|
under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>mng-6972-allow-access-to-graph-package</groupId>
|
||||||
|
<artifactId>build-plugin</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>${maven.compiler.source}</maven.compiler.target>
|
||||||
|
|
||||||
|
<plexus-component.version>1.5.5</plexus-component.version>
|
||||||
|
<maven-version>3.3.1</maven-version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven</groupId>
|
||||||
|
<artifactId>maven-core</artifactId>
|
||||||
|
<version>${maven-version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
|
<artifactId>plexus-component-annotations</artifactId>
|
||||||
|
<version>${plexus-component.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
|
<artifactId>plexus-component-metadata</artifactId>
|
||||||
|
<version>${plexus-component.version}</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>generate-metadata</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.example;
|
||||||
|
|
||||||
|
import java.lang.IllegalStateException;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import org.apache.maven.AbstractMavenLifecycleParticipant;
|
||||||
|
import org.apache.maven.MavenExecutionException;
|
||||||
|
import org.apache.maven.execution.MavenSession;
|
||||||
|
import org.apache.maven.execution.ProjectDependencyGraph;
|
||||||
|
import org.apache.maven.graph.GraphBuilder;
|
||||||
|
import org.apache.maven.model.building.ModelProblem;
|
||||||
|
import org.apache.maven.model.building.Result;
|
||||||
|
import org.apache.maven.project.MavenProject;
|
||||||
|
import org.codehaus.plexus.component.annotations.Component;
|
||||||
|
import org.codehaus.plexus.component.annotations.Requirement;
|
||||||
|
|
||||||
|
@Component( role = AbstractMavenLifecycleParticipant.class )
|
||||||
|
public class BuildExtensionUsingGraphPackage extends AbstractMavenLifecycleParticipant
|
||||||
|
{
|
||||||
|
|
||||||
|
@Requirement( hint = GraphBuilder.HINT )
|
||||||
|
private GraphBuilder graphBuilder;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterProjectsRead( final MavenSession session ) throws MavenExecutionException
|
||||||
|
{
|
||||||
|
Objects.requireNonNull( graphBuilder, "graphBuilder should be available in build extension" );
|
||||||
|
|
||||||
|
Result<? extends ProjectDependencyGraph> graphResult = graphBuilder.build( session );
|
||||||
|
Objects.requireNonNull( graphResult, "graphResult should have been built" );
|
||||||
|
|
||||||
|
for ( ModelProblem problem : graphResult.getProblems() )
|
||||||
|
{
|
||||||
|
if ( problem.getSeverity() == ModelProblem.Severity.WARNING )
|
||||||
|
{
|
||||||
|
throw new IllegalStateException( "unexpected WARNING found: " + problem );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new IllegalStateException( "unexpected Problem found: " + problem );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
or more contributor license agreements. See the NOTICE file
|
||||||
|
distributed with this work for additional information
|
||||||
|
regarding copyright ownership. The ASF licenses this file
|
||||||
|
to you under the Apache License, Version 2.0 (the
|
||||||
|
"License"); you may not use this file except in compliance
|
||||||
|
with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing,
|
||||||
|
software distributed under the License is distributed on an
|
||||||
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
KIND, either express or implied. See the License for the
|
||||||
|
specific language governing permissions and limitations
|
||||||
|
under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>mng-6972-allow-access-to-graph-package</groupId>
|
||||||
|
<artifactId>using-module</artifactId>
|
||||||
|
<version>1</version>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<extensions>
|
||||||
|
<extension>
|
||||||
|
<groupId>mng-6972-allow-access-to-graph-package</groupId>
|
||||||
|
<artifactId>build-plugin</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
</extension>
|
||||||
|
</extensions>
|
||||||
|
</build>
|
||||||
|
</project>
|
Loading…
Reference in New Issue