You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2021/09/13 21:16:05 UTC
[maven-artifact-plugin] branch master updated: [MARTIFACT-26]
ignore artifacts pointing to inexistent file
This is an automated email from the ASF dual-hosted git repository.
hboutemy 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 c079145 [MARTIFACT-26] ignore artifacts pointing to inexistent file
c079145 is described below
commit c0791458a5bd892da87cfd8bb76233ea8ceaedca
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Mon Sep 13 23:16:02 2021 +0200
[MARTIFACT-26] ignore artifacts pointing to inexistent file
---
src/it/buildinfo-dir/pom.xml | 96 ++++++++++++++++++++++
.../artifact/buildinfo/BuildInfoWriter.java | 11 ++-
2 files changed, 105 insertions(+), 2 deletions(-)
diff --git a/src/it/buildinfo-dir/pom.xml b/src/it/buildinfo-dir/pom.xml
new file mode 100644
index 0000000..823b2de
--- /dev/null
+++ b/src/it/buildinfo-dir/pom.xml
@@ -0,0 +1,96 @@
+<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.plugins.artifact.its</groupId>
+ <artifactId>apache-karaf</artifactId>
+ <packaging>pom</packaging>
+ <version>4.3.3</version>
+ <name>Maven Artifact Plugin buildinfo IT: Apache Karaf :: Assemblies :: Default Distribution</name>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.build.outputTimestamp>2021-09-13T22:04:00Z</project.build.outputTimestamp>
+ <maven.install.skip>true</maven.install.skip>
+ <maven.deploy.skip>true</maven.deploy.skip>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.karaf</groupId>
+ <artifactId>karaf-bom</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.karaf.features</groupId>
+ <artifactId>framework</artifactId>
+ <type>kar</type>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-maven-plugin</artifactId>
+ <version>${project.version}</version>
+ <executions>
+ <execution>
+ <id>install-kar</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>assembly</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>package</id>
+ <goals>
+ <goal>archive</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>@project.groupId@</groupId>
+ <artifactId>@project.artifactId@</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>buildinfo</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/src/main/java/org/apache/maven/plugins/artifact/buildinfo/BuildInfoWriter.java b/src/main/java/org/apache/maven/plugins/artifact/buildinfo/BuildInfoWriter.java
index ba7aae7..9293ba4 100644
--- a/src/main/java/org/apache/maven/plugins/artifact/buildinfo/BuildInfoWriter.java
+++ b/src/main/java/org/apache/maven/plugins/artifact/buildinfo/BuildInfoWriter.java
@@ -205,13 +205,20 @@ class BuildInfoWriter
throws MojoExecutionException
{
prefix = prefix + i;
- if ( artifact.getFile().isDirectory() )
+ File artifactFile = artifact.getFile();
+ if ( artifactFile.isDirectory() )
{
// edge case found in a distribution module with default packaging and skip set for
// m-jar-p: should use pom packaging instead
throw new MojoExecutionException( "Artifact " + artifact.getId() + " points to a directory: "
- + artifact.getFile() + ". Packaging should be 'pom'?" );
+ + artifactFile + ". Packaging should be 'pom'?" );
}
+ if ( !artifactFile.isFile() )
+ {
+ log.warn( "Ignoring artifact " + artifact.getId() + " because it points to inexistent " + artifactFile );
+ return;
+ }
+
printFile( prefix, artifact.getFile(), getArtifactFilename( artifact ) );
artifacts.put( artifact, prefix );
}