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

[ERROR] No plugin found for prefix 'jib' in the current project and in the plugin groups... #522

Closed
Zephery opened this issue Jul 10, 2018 · 13 comments

Comments

@Zephery
Copy link

Zephery commented Jul 10, 2018

[ERROR] No plugin found for prefix 'jib' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/Users/zepherywen/.m2/repository), nexus (http://x.x.x.x:8081/nexus/content/groups/public/), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException

@coollog
Copy link
Contributor

coollog commented Jul 10, 2018

Hi @Zephery , Jib should be available in the Maven Central repository (https://repo.maven.apache.org/maven2/com/google/cloud/tools/jib-maven-plugin/). Could you share your pom.xml or a snippet of it to help diagnose this issue?

@coollog
Copy link
Contributor

coollog commented Jul 11, 2018

Closing unless you are still experiencing this issue.

@coollog coollog closed this as completed Jul 11, 2018
@KTannenberg
Copy link

To anyone who encounters same issue.

In order to use short name for plugin, you need to add new pluginGroup to your settings.xml:

<settings>
  ...
  <pluginGroups>
    ...
    <pluginGroup>com.google.cloud.tools</pluginGroup>
    ...
  </pluginGroups>
  ...
</settings>

Once this is done you can use mvn clean compile jib:<jib-goal> instead of mvn clean compile com.google.cloud.tools:jib-maven-plugin:<jib-goal>

More details about plugin groups: https://maven.apache.org/guides/introduction/introduction-to-plugin-prefix-mapping.html

@loosebazooka
Copy link
Member

That's strange, if I understand correctly, plugin prefix mapping should only be necessary if youre not explicitly declaring the plugin in your pom? Is that the case here?

@KTannenberg
Copy link

KTannenberg commented Jul 29, 2018

@loosebazooka,
I've rechecked without adding pluginGroup and both of these works as expected (only module declares jib plugin, parent pom doesn't):

cd project && mvn jib:build --projects :module
cd project/module && mvn jib:build

Adding jib to parent pom as pluginManagement solves this issue, but now jib will attempt to package every module into container and fails as there are no target/ for pom-only modules (this is fixed in #734)

@lgd8069465
Copy link

lgd8069465 commented Feb 15, 2019

[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'jib' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (E:\Develop\Maven\local_repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException

change aliyun

[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'jib' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\Administrator.m2\repository), central (http://maven.aliyun.com/nexus/content/groups/public), snapshots (http://maven.aliyun.com/nexus/content/groups/public), rdc-releases (https://repo.rdc.aliyun.com/repository/43168-release-Ho1L6B/), rdc-snapshots (https://repo.rdc.aliyun.com/repository/43168-snapshot-PR5W0P/)] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException

mvn -v
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-18T02:33:14+08:00)
Maven home: E:\Develop\Maven\apache-maven-3.5.4\bin..
Java version: 1.8.0_162, vendor: Oracle Corporation, runtime: C:\Environment\JDK8\jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

my pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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">
	<build>
    <plugins>
	<plugin>
        <groupId>com.google.cloud.tools</groupId>
        <artifactId>jib-maven-plugin</artifactId>
        <version>1.0.0</version>
        <configuration>
		  <from>
           <image>openjdk:alpine</image>
          </from>
          <to>
            <image>hub.io/jib/basedata-jib-test</image>
			<tags>
              <tag>201902151702</tag>
              <tag>latest</tag>
            </tags>
          </to>
        </configuration>
		<executions>
          <execution>
           <phase>package</phase>
           <goals>
             <goal>build</goal>
           </goals>
          </execution>
        </executions>
      </plugin>
	  </plugins>
  </build>
	  
</project>

@briandealwis
Copy link
Member

@lgd8069465 please open new issues instead of piggy-backing on existing issues. Then reference related issues.

Your pom.xml isn't valid: Maven 3.5.4 complains that it's missing a modelVersion, groupId, artifactId, and version. When I add those in, Maven is able to resolve jib via mvn jib:build though it complains since I have no classes etc. to package.

@lgd8069465
Copy link

lgd8069465 commented Feb 19, 2019

@briandealwis
my bad
here is my pom.xml

<?xml version="1.0" encoding="utf-8"?>

<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">  
  <parent> 
    <groupId>com.lkc.zms</groupId>  
    <artifactId>zms</artifactId>  
    <version>0.0.1-SNAPSHOT</version> 
  </parent>  
  <modelVersion>4.0.0</modelVersion>  
  <artifactId>basedata</artifactId>  
  <version>0.0.1-SNAPSHOT</version>  
  <packaging>jar</packaging>   
  <build> 
    <plugins> 
      <plugin> 
        <groupId>com.google.cloud.tools</groupId>  
        <artifactId>jib-maven-plugin</artifactId>  
        <version>1.0.0</version>  
        <configuration> 
          <to> 
            <image>hub.io/jib/basedata-jib-test</image>  
            <tags> 
              <tag>201902180927</tag> 
            </tags> 
          </to> 
        </configuration> 
      </plugin> 
    </plugins> 
  </build> 
</project>

but it's still wrong

[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'jib' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (E:\Develop\Maven\local_repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException: No plugin found for prefix 'jib' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (E:\Develop\Maven\local_repository), central (https://repo.maven.apache.org/maven2)]
    at org.apache.maven.plugin.prefix.internal.DefaultPluginPrefixResolver.resolve (DefaultPluginPrefixResolver.java:95)
    at org.apache.maven.lifecycle.internal.MojoDescriptorCreator.findPluginForPrefix (MojoDescriptorCreator.java:266)
    at org.apache.maven.lifecycle.internal.MojoDescriptorCreator.getMojoDescriptor (MojoDescriptorCreator.java:220)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalculator.calculateTaskSegments (DefaultLifecycleTaskSegmentCalculator.java:104)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalculator.calculateTaskSegments (DefaultLifecycleTaskSegmentCalculator.java:83)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:89)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException

I refer to https://github.com/mfriedenhagen/dummy-lifecycle-mapping-plugin

@chanseokoh
Copy link
Member

Haven't tried, but I guess your pom.xml is still missing <groupId>.

@briandealwis
Copy link
Member

@chanseokoh there's a groupId in the parent.

@lgd8069465 your example works for me when I comment out your parent (since I don't have access to it) and copy the groupId. At this point, this seems to be a problem with your local Maven installation. Please open a new issue and include your full build log.

@GoogleContainerTools GoogleContainerTools locked as off-topic and limited conversation to collaborators Feb 19, 2019
@GoogleContainerTools GoogleContainerTools unlocked this conversation Feb 20, 2019
@briandealwis
Copy link
Member

@lgd8069465 I apologize for locking this issue, and you were completely right to comment on this issue.

I just hit this issue in creating an example multi-module project for Skaffold that uses Jib, and now I understand @lgd8069465's example as well as @KTannenberg's fix: the problem is the mvn jib:xxx is being run from the parent which is not configuring the jib-maven-plugin, which is instead being configured in a child project. So running mvn jib:xxx from the parent project will fail as jib hasn't been referenced.

So a fix is to reference jib-maven-plugin from the parent, such as through a <pluginManagement> block:

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>com.google.cloud.tools</groupId>
          <artifactId>jib-maven-plugin</artifactId>
          <version>1.0.0</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

@lgd8069465
Copy link

@briandealwis @KTannenberg @chanseokoh
Thank you very much
It's worked

@fezho
Copy link

fezho commented Apr 8, 2020

Also got this issue, my root cause is somebody commented the <parent> </parent> tag in one of the child module's pom.xml, after uncomment it, the build works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants