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

Fix #112 by removing artifact type/extension check #113

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.google.common.base.Joiner;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.handler.ArtifactHandler;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.logging.Logger;
import org.eclipse.aether.RepositorySystemSession;
Expand Down Expand Up @@ -59,22 +60,7 @@ public String getCoordinates(Artifact artifact) {
log.debug(" Encoding Coordinates For: " + artifact);

// Get the extension according to the artifact type.
String extension = session.getArtifactTypeRegistry().get(artifact.getType()).getExtension();

// assert that the file extension matches the artifact packaging extension type, if there is an artifact file.
if (artifact.getFile() != null && !artifact.getFile().getName().toLowerCase().endsWith(extension.toLowerCase())) {
String filename = artifact.getFile().getName();
String fileExtension = filename.substring(filename.lastIndexOf('.') + 1);
log.warn(
" Artifact file name: " + artifact.getFile().getName() + " of type "
+ artifact.getType() + " does not match the extension for the ArtifactType: "
+ extension + ". "
+ "This is likely an issue with the packaging definition for '" + artifact.getType()
+ "' artifacts, which may be missing an extension definition. "
+ "The gitflow helper catalog will use the actual file extension: " + fileExtension
);
extension = fileExtension;
}
String extension = artifact.getArtifactHandler().getExtension();

return getCoordinates(
artifact.getGroupId(),
Expand Down
29 changes: 28 additions & 1 deletion src/test/resources/project-stub/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<artifactId>gitflow-helper-maven-plugin-test-stub</artifactId>
<version>${stub.project.version}</version>

<packaging>jar</packaging>
<packaging>bundle</packaging>

<repositories>
<repository>
Expand Down Expand Up @@ -91,6 +91,33 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>attach-text-file</id>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>src/build/resources/my-text-file.txt</file>
<type>text-file</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>4.2.0</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test123