[MNG-8336] Only inject plugins information if requested (#1904)

This commit is contained in:
Guillaume Nodet 2024-11-15 10:24:21 +01:00 committed by GitHub
parent 46707e0f28
commit a14732597b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 114 additions and 1 deletions

View File

@ -936,6 +936,10 @@ public class DefaultProjectBuilder implements ProjectBuilder {
}
project.setRemoteArtifactRepositories(remoteRepositories);
return lifecycleBindingsInjector.injectLifecycleBindings(model3.getDelegate(), request, problems);
if (projectBuildingRequest.isProcessPlugins()) {
return lifecycleBindingsInjector.injectLifecycleBindings(model3.getDelegate(), request, problems);
} else {
return model3.getDelegate();
}
}
}

View File

@ -0,0 +1,53 @@
/*
* 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.
*/
package org.apache.maven.it;
import java.io.File;
import java.util.List;
import org.apache.maven.shared.verifier.Verifier;
import org.apache.maven.shared.verifier.util.ResourceExtractor;
import org.junit.jupiter.api.Test;
/**
* This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-8336">MNG-8336</a>.
*/
class MavenITmng8336UnknownPackagingTest extends AbstractMavenIntegrationTestCase {
MavenITmng8336UnknownPackagingTest() {
super("[4.0.0-beta-6,)");
}
/**
* Verify that the build succeeds
*/
@Test
void testUnknownPackaging() throws Exception {
File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-8336-unknown-packaging");
Verifier verifier = newVerifier(testDir.getAbsolutePath(), "remote");
verifier.addCliArgument("clean");
verifier.addCliArgument("org.codehaus.mojo:license-maven-plugin:2.4.0:add-third-party");
verifier.execute();
// verify log
List<String> lines = verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false);
assertTrue(lines.stream().noneMatch(s -> s.contains("Unable to obtain POM for artifact")));
}
}

View File

@ -120,6 +120,7 @@ public class TestSuiteOrdering implements ClassOrderer {
* the tests are to finishing. Newer tests are also more likely to fail, so this is
* a fail fast technique as well.
*/
suite.addTestSuite(MavenITmng8336UnknownPackagingTest.class);
suite.addTestSuite(MavenITmng8340GeneratedPomInTargetTest.class);
suite.addTestSuite(MavenITmng8360SubprojectProfileActivationTest.class);
suite.addTestSuite(MavenITmng8347TransitiveDependencyManagerTest.class);

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.danthe1st</groupId>
<artifactId>maven-repro</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<maven.compiler.release>17</maven.compiler.release>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox-io</artifactId>
<version>3.0.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<release>17</release>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,27 @@
/*
* 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.
*/
package io.github.danthe1st.mavenrepro;
public class MavenRepro {
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}