Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
21 changes: 21 additions & 0 deletions src/it/compare-ignore/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 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
61 changes: 61 additions & 0 deletions src/it/compare-ignore/modA/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?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>ignore</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>ignore-modA</artifactId>
<packaging>jar</packaging>
<name>ignore module A</name>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>

<plugins>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
<version>@project.version@</version>
<configuration>
<ignore>*/ignore-modA-*.jar</ignore>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should not be configured in this module's POM but in parent

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it relates to artifacts produced by this module though, isn't it better to be 'closer' to the source?

or is artifact always intended to be configured at the 'top-level' of the build?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I never thought precisely at it in the past, but now I see it arises naturally

I'd say, yes, that it's intended to be configured at top-level, because it's a full build process that has to be checked. Partial checks run one one single module are just partial executions: it's useful to get faster feedback when testing, but at the end, it's the whole build that counts

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and TBH, I did not even expect compare goal to be configured in pom.xml: I always use this goal fully on CLI, because I compare a rebuild done on one situation with an initial build that may have been done anywhere, and the more environmental distance between the 2 builds, the better to discover unexpected discrepencies

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it wouldn't be part of the regular build. In practice we configure it in pluginManagement.

</configuration>
<executions>
<execution>
<goals>
<goal>compare</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
18 changes: 18 additions & 0 deletions src/it/compare-ignore/modA/src/main/resources/filtered.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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.build.outputTimestamp=${project.build.outputTimestamp}
42 changes: 42 additions & 0 deletions src/it/compare-ignore/modB/pom.xml
Original file line number Diff line number Diff line change
@@ -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>ignore</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>ignore-modB</artifactId>
<packaging>pom</packaging>
<name>ignore module B</name>

<dependencies>
<dependency>
<groupId>org.apache.maven.plugins.it</groupId>
<artifactId>ignore-modA</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
70 changes: 70 additions & 0 deletions src/it/compare-ignore/pom.xml
Original file line number Diff line number Diff line change
@@ -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>ignore</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>
3 changes: 3 additions & 0 deletions src/it/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<reference.repo>nexus</reference.repo>
</properties>
<repositories>
<repository>
<id>local.central</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ public abstract class AbstractBuildinfoMojo extends AbstractMojo {
* Ignore javadoc attached artifacts from buildinfo generation.
*/
@Parameter(property = "buildinfo.ignoreJavadoc", defaultValue = "true")
private boolean ignoreJavadoc;
boolean ignoreJavadoc;

/**
* Artifacts to ignore, specified as a glob matching against <code>${groupId}/${filename}</code>, for example
* <code>*</>/*.xml</code>.
*/
@Parameter(property = "buildinfo.ignore", defaultValue = "")
private List<String> ignore;
List<String> ignore;

/**
* Detect projects/modules with install or deploy skipped: avoid taking fingerprints.
Expand Down Expand Up @@ -148,6 +148,8 @@ public void execute() throws MojoExecutionException {

hasBadOutputTimestamp(outputTimestamp, getLog(), project, session.getProjects(), diagnose);

initModuleBuildInfo();

if (!mono) {
// if module skips install and/or deploy
if (isSkip(project)) {
Expand All @@ -171,6 +173,10 @@ public void execute() throws MojoExecutionException {
execute(artifacts);
}

protected void initModuleBuildInfo() {
BuildInfoWriter.addModuleBuildInfo(getPluginContext(), ignore, ignoreJavadoc);
}

static boolean hasBadOutputTimestamp(
String outputTimestamp,
Log log,
Expand Down Expand Up @@ -303,9 +309,9 @@ protected void copyAggregateToRoot(File aggregate) throws MojoExecutionException

protected BuildInfoWriter newBuildInfoWriter(PrintWriter p, boolean mono) {
BuildInfoWriter bi = new BuildInfoWriter(getLog(), p, mono, rtInformation);
bi.setIgnoreJavadoc(ignoreJavadoc);
bi.setIgnore(ignore);
bi.setToolchain(getToolchain());
bi.setSession(session);
bi.setPluginContext(getPluginContext());

return bi;
}
Expand All @@ -329,11 +335,11 @@ protected Map<Artifact, String> generateBuildinfo(boolean mono) throws MojoExecu

// artifact(s) fingerprints
if (mono) {
bi.printArtifacts(project);
bi.printArtifacts(project, project);
} else {
for (MavenProject project : session.getProjects()) {
if (!isSkip(project)) {
bi.printArtifacts(project);
for (MavenProject moduleProject : session.getProjects()) {
if (!isSkip(moduleProject)) {
bi.printArtifacts(moduleProject, project);
}
}
}
Expand Down
Loading