4

I have a quarkus project which uses jib. I'm using skaffold to deploy the application to a local k8s cluster, this is my skaffold.yaml file:

apiVersion: skaffold/v1
kind: Config
build:
  artifacts:
  - image: local-registry.localhost:12345/rc/my-image-name
    jib:
      args: ['-DskipTests']
deploy:
  kubectl:
    manifests:
      - target/kubernetes/kubernetes.yml

However, when I run skaffold dev I get the following issue:

listing files: could not fetch dependencies for workspace .: initial Jib dependency refresh failed: failed to get Jib dependencies: running [mvn jib:_skaffold-fail-if-jib-out-of-date -Djib.requiredVersion=1.4.0 --non-recursive jib:_skaffold-files-v2 --quiet --batch-mode]
 - stdout: "[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 (/home/dev/.m2/repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]\n[ERROR] \n[ERROR]

How can I fix that " No plugin found for prefix 'jib' in the current project and in the plugin groups" error?

Update to the question:

I added the following profile to the pom.xml, the same way I've done in a spring boot project:

<profiles>
    <profile>
        <id>jib</id>
        <activation>
            <activeByDefault>false</activeByDefault>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>com.google.cloud.tools</groupId>
                    <artifactId>jib-maven-plugin</artifactId>
                    <version>3.1.4</version>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

However, now I am getting the following issue:

[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:3.1.4:dockerBuild (default-cli) on project report-center-reports: Main class was not found, perhaps you should add a `mainClass` configuration to jib-maven-plugin -> [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/MojoExecutionException
maven build failed: exit status 1. See the build transcript for suggestions..
Carlos Gonzalez
  • 607
  • 1
  • 5
  • 13

1 Answers1

2

Your new error says Main class was not found, perhaps you should add a mainClass configuration to jib-maven-plugin. Jib searched the classpath to find a class with a public static void main(String[]) and was unable to find one. You need such a main class as that's how your container will start executing.

There are a few reasons this can happen, including:

  • your main class is not a runtime dependency, and so was not resolved
  • your project is missing a dependency
  • you're attempting to package up the wrong dependency
Brian de Alwis
  • 2,814
  • 2
  • 18
  • 32