Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MNG-7667] Fix Bootstrap IT #230

Merged
merged 4 commits into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ public void testBootstrap()
verifier.addCliOption( "--settings" );
verifier.addCliOption( "settings.xml" );
verifier.addCliOption( "-Dbootstrap=" + getClass().getResource( "/bootstrap.txt" ).toURI().getPath() );
verifier.addCliArgument( "install" );
verifier.addCliArgument( "process-resources" ); // bootstrap plugin is bound to this phase, do not go further
// note: as maven-plugin packaging would fail as there is no Mojo!
verifier.execute();
verifier.verifyErrorFreeLog();
}
Expand Down
57 changes: 57 additions & 0 deletions core-it-suite/src/test/resources/bootstrap/jar/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?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>
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.apache.maven.its.bootstrap</groupId>
<artifactId>maven-it-boostrap</artifactId>
<version>1.0</version>
</parent>

<artifactId>jar</artifactId>
<packaging>jar</packaging>

<name>Maven Integration Test :: Boostrap :: jar</name>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its</groupId>
<artifactId>maven-it-plugin-bootstrap</artifactId>
<version>2.1-SNAPSHOT</version>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>download</goal>
</goals>
<configuration>
<!-- We do not what to resolve what parent did, we are interested in packaging only -->
<file>${bootstrap}-nofile</file>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
57 changes: 57 additions & 0 deletions core-it-suite/src/test/resources/bootstrap/maven-plugin/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?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>
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.apache.maven.its.bootstrap</groupId>
<artifactId>maven-it-boostrap</artifactId>
<version>1.0</version>
</parent>

<artifactId>maven-plugin</artifactId>
<packaging>maven-plugin</packaging>

<name>Maven Integration Test :: Boostrap :: maven-plugin</name>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its</groupId>
<artifactId>maven-it-plugin-bootstrap</artifactId>
<version>2.1-SNAPSHOT</version>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>download</goal>
</goals>
<configuration>
<!-- We do not what to resolve what parent did, we are interested in packaging only -->
<file>${bootstrap}-nofile</file>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
8 changes: 5 additions & 3 deletions core-it-suite/src/test/resources/bootstrap/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ under the License.
config all around in the IT POMs.
</description>

<properties>
<maven.test.skip>true</maven.test.skip>
</properties>
<modules>
<module>jar</module>
<module>maven-plugin</module>
<module>war</module>
</modules>

<build>
<!-- This merely locks the plugin versions to disable auto-update -->
Expand Down
57 changes: 57 additions & 0 deletions core-it-suite/src/test/resources/bootstrap/war/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?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>
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.apache.maven.its.bootstrap</groupId>
<artifactId>maven-it-boostrap</artifactId>
<version>1.0</version>
</parent>

<artifactId>war</artifactId>
<packaging>war</packaging>

<name>Maven Integration Test :: Boostrap :: war</name>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its</groupId>
<artifactId>maven-it-plugin-bootstrap</artifactId>
<version>2.1-SNAPSHOT</version>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>download</goal>
</goals>
<configuration>
<!-- We do not what to resolve what parent did, we are interested in packaging only -->
<file>${bootstrap}-nofile</file>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.Plugin;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Component;
Expand Down Expand Up @@ -104,6 +105,21 @@ public void execute() throws MojoFailureException
}
}

// In project this plugin is executing will collect default bound plugins in packaging
try
{
for ( Plugin plugin : session.getCurrentProject().getBuildPlugins() )
{
dependencies.add( toDependency(
slawekjaranowski marked this conversation as resolved.
Show resolved Hide resolved
plugin.getGroupId() + ":" + plugin.getArtifactId() + ":" + plugin.getVersion()
) );
}
}
catch ( Exception e )
{
throw new MojoFailureException( e );
}

ProjectBuildingRequest projectBuildingRequest = session.getProjectBuildingRequest();
RepositorySystemSession repositorySystemSession = projectBuildingRequest.getRepositorySession();
List<RemoteRepository> repos = RepositoryUtils.toRepos( projectBuildingRequest.getRemoteRepositories() );
Expand Down