Reputation: 2971
followed some maven docker examples, came up with following code, run mvn package dockerfile:build but get these errors: [ERROR] No plugin found for prefix 'dockerfile' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories ...
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompnay.learning</groupId>
<artifactId>my-app-base-pom</artifactId>
<version>0.0.1</version>
<properties>
<dockerfile.version>0.0.1</dockerfile.version>
<docker.image.prefix>AdminService</docker.image.prefix>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>0.0.1</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>build</goal>
</goals>
<configuration>
<repository>docker.io/kkapelon/docker-maven-comparsion</repository>
<tag>projectVersion</tag>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Where should i go from here pls ?
Upvotes: 3
Views: 4410
Reputation: 4721
You most probably get the error because the plugin (which is version 0.0.1
) is missing. Check for any maven
warnings
[WARNING] The POM for com.spotify:dockerfile-maven-plugin:jar:0.0.1 is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for ...
Because it fails to retrieve the plugin descriptor, maven does not know there is a dockerfile
prefix configuration associated with the plugin and hence the error "No plugin found for prefix" comes up. This configuration is stored in the plugin's path on the maven
repository
The conventional artifact ID formats to use are:
maven-${prefix}-plugin
- for official plugins maintained by the Apache Maven team itself (you must not use this naming pattern for your plugin, see this note for more informations)${prefix}-maven-plugin
for plugins from other sources.If your plugin's artifactId fits this pattern, Maven will automatically map your plugin to the correct prefix in the metadata stored within your plugin's groupId path on the repository.
More about plugin prefix resolution here
For version 1.4.0, for example, the descriptor (i.e. pom
file)
has a configuration section:
<configuration>
<goalPrefix>dockerfile</goalPrefix>
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
Changing the version to something more recent (>1.2.0) should fix the error.
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.4.0</version>
...
</plugin>
Run with:
mvn package dockerfile:build
Upvotes: 3