This is an automated email from the ASF dual-hosted git repository. elharo pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-artifact-plugin.git
The following commit(s) were added to refs/heads/master by this push: new ed91a5f [MARTIFACT-79] Check `session.allProjects` for `executionRoot`, not just `session.projects` (#70) ed91a5f is described below commit ed91a5f03ae5f731753bf1adf205632171a865c1 Author: Christopher Ng <fac...@gmail.com> AuthorDate: Fri Dec 13 12:49:59 2024 +0100 [MARTIFACT-79] Check `session.allProjects` for `executionRoot`, not just `session.projects` (#70) When resuming a multi-module build, the `executionRoot` may not be included in `session.projects`. `session.allProjects` contains all projects in the reactor build. --- src/it/compare-resume/invoker.properties | 23 +++++++ src/it/compare-resume/modA/pom.xml | 34 +++++++++++ src/it/compare-resume/modB/pom.xml | 42 +++++++++++++ src/it/compare-resume/pom.xml | 70 ++++++++++++++++++++++ .../artifact/buildinfo/AbstractBuildinfoMojo.java | 2 +- 5 files changed, 170 insertions(+), 1 deletion(-) diff --git a/src/it/compare-resume/invoker.properties b/src/it/compare-resume/invoker.properties new file mode 100644 index 0000000..3d01e2a --- /dev/null +++ b/src/it/compare-resume/invoker.properties @@ -0,0 +1,23 @@ +# 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. + +# initial reference build: install +invoker.goals.1=clean install +# second build: verify (could be package, but not install to avoid overriding reference) +invoker.goals.2=clean verify artifact:compare +# third build: verify resuming from second module +invoker.goals.3=clean verify artifact:compare -rf :resume-modA diff --git a/src/it/compare-resume/modA/pom.xml b/src/it/compare-resume/modA/pom.xml new file mode 100644 index 0000000..a90c776 --- /dev/null +++ b/src/it/compare-resume/modA/pom.xml @@ -0,0 +1,34 @@ +<?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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.maven.plugins.it</groupId> + <artifactId>resume</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + <artifactId>resume-modA</artifactId> + <packaging>pom</packaging> + <name>resume module A</name> +</project> diff --git a/src/it/compare-resume/modB/pom.xml b/src/it/compare-resume/modB/pom.xml new file mode 100644 index 0000000..220284f --- /dev/null +++ b/src/it/compare-resume/modB/pom.xml @@ -0,0 +1,42 @@ +<?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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.maven.plugins.it</groupId> + <artifactId>resume</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + <artifactId>resume-modB</artifactId> + <packaging>pom</packaging> + <name>resume module B</name> + + <dependencies> + <dependency> + <groupId>org.apache.maven.plugins.it</groupId> + <artifactId>resume-modA</artifactId> + <version>1.0-SNAPSHOT</version> + </dependency> + </dependencies> +</project> diff --git a/src/it/compare-resume/pom.xml b/src/it/compare-resume/pom.xml new file mode 100644 index 0000000..83f40a0 --- /dev/null +++ b/src/it/compare-resume/pom.xml @@ -0,0 +1,70 @@ +<?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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.maven.plugins.it</groupId> + <artifactId>resume</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>pom</packaging> + + <description>An IT verifying compare works when resuming a multi-module build.</description> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + + <prerequisites> + <maven>3.0.5</maven> + </prerequisites> + + <distributionManagement> + <snapshotRepository> + <id>local-snapshots</id> + <url>file://${basedir}/target/remote-repo</url> + <uniqueVersion>false</uniqueVersion> + </snapshotRepository> + </distributionManagement> + + <modules> + <module>modB</module> + <module>modA</module> + </modules> + + <build> + <plugins> + <plugin> + <groupId>@project.groupId@</groupId> + <artifactId>@project.artifactId@</artifactId> + <version>@project.version@</version> + <executions> + <execution> + <goals> + <goal>compare</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/src/main/java/org/apache/maven/plugins/artifact/buildinfo/AbstractBuildinfoMojo.java b/src/main/java/org/apache/maven/plugins/artifact/buildinfo/AbstractBuildinfoMojo.java index 952e5f5..51b0e0e 100644 --- a/src/main/java/org/apache/maven/plugins/artifact/buildinfo/AbstractBuildinfoMojo.java +++ b/src/main/java/org/apache/maven/plugins/artifact/buildinfo/AbstractBuildinfoMojo.java @@ -356,7 +356,7 @@ public abstract class AbstractBuildinfoMojo extends AbstractMojo { } protected MavenProject getExecutionRoot() { - for (MavenProject p : session.getProjects()) { + for (MavenProject p : session.getAllProjects()) { if (p.isExecutionRoot()) { return p; }