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

Have Quarkus buildpack set env variable to ensure executable-jar buildpack picks the correct JAR #12

Open
sebastiangraf opened this issue Feb 1, 2023 · 7 comments
Labels
note:on-hold We can't start working on this issue yet type:enhancement A general enhancement

Comments

@sebastiangraf
Copy link

When building the Sample Project located under https://github.com/paketo-buildpacks/samples/tree/main/java/native-image/quarkus-native with a local copy of this buildpack, the resulting image is not executable. The same applies for a more recent version of quarkus and jvm.

Expected Behavior

Checking out this repository under /tmp/quarkus and invoked via

cd buildpacks-samples/java/native-image/quarkus-native
pack build -B paketobuildpacks/builder:tiny -b /tmp/quarkus test-image

Result would be an image test-image that would be directly executable. When the image runs, something like

__  ____  __  _____   ___  __ ____  ______ 
 --/ __ \/ / / / _ | / _ \/ //_/ / / / __/ 
 -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \   
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/   
2023-02-01 07:45:58,804 INFO  [io.quarkus] (main) getting-started 1.0.0-SNAPSHOT native (powered by Quarkus 2.11.3.Final) started in 0.274s. Listening on: http://0.0.0.0:8080
2023-02-01 07:45:58,831 INFO  [io.quarkus] (main) Profile prod activated. 
2023-02-01 07:45:58,832 INFO  [io.quarkus] (main) Installed features: [cdi, resteasy, smallrye-context-propagation, vertx]

should occur.

Current Behavior

Build runs, but is not compiling anything

➜  quarkus-native git:(main) pack build -B paketobuildpacks/builder:tiny -b /tmp/quarkus test-image
tiny: Pulling from paketobuildpacks/builder
Digest: sha256:e1cdc815760e42e565e1851595a725e3368be44d75a44d9f70898806addd7564
Status: Image is up to date for paketobuildpacks/builder:tiny
tiny-cnb: Pulling from paketobuildpacks/run
Digest: sha256:4a34d4c8e98f0b7f0927ff2f12db95abadc1d5fe5a5ea4ac8990fe2ced684559
Status: Image is up to date for paketobuildpacks/run:tiny-cnb
===> ANALYZING
Restoring data for SBOM from previous image
===> DETECTING
paketo-buildpacks/quarkus {{.version}}
===> RESTORING
===> BUILDING

Paketo Buildpack for Quarkus {{.version}}
  https://github.com/paketo-buildpacks/quarkus
  Build Configuration:
    $BP_MAVEN_POM_FILE  pom.xml  the location of the main pom.xml file, relative to the application root
    Writing env.build/BP_MAVEN_BUILD_ARGUMENTS.default
    Writing env.build/BP_MAVEN_BUILT_ARTIFACT.default
  4 application slices
===> EXPORTING
Reusing layer 'launch.sbom'
Reusing 4/5 app layer(s)
Adding 1/5 app layer(s)
Reusing layer 'launcher'
Reusing layer 'config'
Adding label 'io.buildpacks.lifecycle.metadata'
Adding label 'io.buildpacks.build.metadata'
Adding label 'io.buildpacks.project.metadata'
no default process type
Saving test-quarkus-buildpack...
*** Images (64ebbd2f48cb):
      test-quarkus-buildpack
Successfully built image  test-image

Executing this image results in

ERROR: failed to launch: determine start command: when there is no default process a command is required

I guess that invoking the quarkus buildpack is not including the java buildpack as no compilation takes place.

Possible Solution

Including the quarkus buildpack directly int he java buildpack might solve the problem.

Steps to Reproduce

  1. Clone samples repository: https://github.com/paketo-buildpacks/samples/tree/main/java/native-image/quarkus-native
  2. Clone this repository: https://github.com/paketo-buildpacks/quarkus
  3. Invoke the tiny-builder with a reference to this cloned buildpack executed on the samples.

Motivations

I try to build a quarkus app with the help of buildpacks :)

@dmikusa
Copy link
Contributor

dmikusa commented Feb 1, 2023

OK, can you try the following build command?

pack build -B paketobuildpacks/builder:tiny -b urn:cnb:builder:paketo-buildpacks/ca-certificates -b urn:cnb:builder:paketo-buildpacks/bellsoft-liberica -b urn:cnb:builder:paketo-buildpacks/syft  -b /tmp/quarkus -b urn:cnb:builder:paketo-buildpacks/maven -b urn:cnb:builder:paketo-buildpacks/executable-jar test-image

alternatively for native-image builds...

pack build -B paketobuildpacks/builder:tiny -b urn:cnb:builder:paketo-buildpacks/ca-certificates -b urn:cnb:builder:paketo-buildpacks/bellsoft-liberica -b urn:cnb:builder:paketo-buildpacks/syft  -b /tmp/quarkus -b urn:cnb:builder:paketo-buildpacks/maven -b urn:cnb:builder:paketo-buildpacks/executable-jar -b urn:cnb:builder:paketo-buildpacks/native-image test-image

When you use the -b argument, you need to feed in a full set of buildpacks to run. Because the Quarkus buildpack needs to run before Maven, we also have to insert it in the middle of the list which is a little messy (there's no easy way to do that on-the-fly with pack).

@matejvasek
Copy link
Contributor

@sebastiangraf have you tried what @dmikusa suggested? Has it worked?

@anthonydahanne
Copy link
Member

I followed your suggestion @dmikusa with:

 pack build -B paketobuildpacks/builder:tiny -b urn:cnb:builder:paketo-buildpacks/ca-certificates -b urn:cnb:builder:paketo-buildpacks/bellsoft-liberica -b urn:cnb:builder:paketo-buildpacks/syft  -b paketo-buildpacks/quarkus -b urn:cnb:builder:paketo-buildpacks/maven -b urn:cnb:builder:paketo-buildpacks/executable-jar test-image

and I ended up with:

docker run -it test-image
Setting Active Processor Count to 8
JVM DNS caching disabled in favor of link-local DNS caching
Calculating JVM memory based on 31791584K available memory
For more information on this calculation, see https://paketo.io/docs/reference/java-reference/#memory-calculator
Calculated JVM Memory Configuration: -XX:MaxDirectMemorySize=10M -Xmx31194324K -XX:MaxMetaspaceSize=85259K -XX:ReservedCodeCacheSize=240M -Xss1M (Total Memory: 31791584K, Thread Count: 250, Loaded Class Count: 12639, Headroom: 0%)
Enabling Java Native Memory Tracking
Adding 137 container CA certificates to JVM truststore
Picked up JAVA_TOOL_OPTIONS: -Djava.security.properties=/layers/paketo-buildpacks_bellsoft-liberica/java-security-properties/java-security.properties -XX:+ExitOnOutOfMemoryError -XX:ActiveProcessorCount=8 -XX:MaxDirectMemorySize=10M -Xmx31194324K -XX:MaxMetaspaceSize=85259K -XX:ReservedCodeCacheSize=240M -Xss1M -XX:+UnlockDiagnosticVMOptions -XX:NativeMemoryTracking=summary -XX:+PrintNMTStatistics
Usage: jandex [-v] [-m] [-o file-name] <directory> | <jar>
        -or-
       jandex [-d] <index-file-name>
Options:
  -v  verbose output
  -m  modify directory or jar instead of creating an external index file
  -o  name the external index file file-name
  -j  export the index file to a jar file
  -d  dump the index file index-file-name

The default behavior, with no options specified, is to autogenerate an external index file

@dmikusa
Copy link
Contributor

dmikusa commented Jun 14, 2023

Can you include the output of pack inspect <app-img>? I'm curious what it has set as the process types 🤔 (UPDATE: after looking at the code, Quarkus bp isn't setting any process types so those would be set by another buildpack, still an interesting data point though).

It looks like it is building and running some command, but that command is failing and complaining about the arguments.

It would also be helpful to get the full build log.

@anthonydahanne
Copy link
Member

no problem.

 pack build -B paketobuildpacks/builder:tiny -b urn:cnb:builder:paketo-buildpacks/ca-certificates -b urn:cnb:builder:paketo-buildpacks/be
llsoft-liberica -b urn:cnb:builder:paketo-buildpacks/syft  -b paketo-buildpacks/quarkus -b urn:cnb:builder:paketo-buildpacks/maven -b urn:cnb:builder:paketo-buildpacks/executable-jar test-image
tiny: Pulling from paketobuildpacks/builder
Digest: sha256:5cd48d376d9435165cb79e67ea2a0ccb334ec6fc8d21455602a58bb1f6e44f44
Status: Image is up to date for paketobuildpacks/builder:tiny
tiny-cnb: Pulling from paketobuildpacks/run
Digest: sha256:73ebaf2a1856d12cb69e85584b76318574ea4b61961765b22ff91f720a5b3880
Status: Image is up to date for paketobuildpacks/run:tiny-cnb
docker.io/paketobuildpacks/quarkus@sha256:67fdaeb31e0a6f78dd09334ee67520a16302983437a81898d052640ae79b174e: Pulling from paketobuildpacks/quarkus
Digest: sha256:67fdaeb31e0a6f78dd09334ee67520a16302983437a81898d052640ae79b174e
Status: Image is up to date for paketobuildpacks/quarkus@sha256:67fdaeb31e0a6f78dd09334ee67520a16302983437a81898d052640ae79b174e
===> ANALYZING
Image with name "test-image" not found
===> DETECTING
paketo-buildpacks/ca-certificates   3.6.2
paketo-buildpacks/bellsoft-liberica 10.2.4
paketo-buildpacks/syft              1.31.0
paketo-buildpacks/quarkus           0.2.0
paketo-buildpacks/maven             6.15.4
paketo-buildpacks/executable-jar    6.7.3
===> RESTORING
===> BUILDING

Paketo Buildpack for CA Certificates 3.6.2
  https://github.com/paketo-buildpacks/ca-certificates
  Launch Helper: Contributing to layer
    Creating /layers/paketo-buildpacks_ca-certificates/helper/exec.d/ca-certificates-helper

Paketo Buildpack for BellSoft Liberica 10.2.4
  https://github.com/paketo-buildpacks/bellsoft-liberica
  Build Configuration:
    $BP_JVM_JLINK_ARGS           --no-man-pages --no-header-files --strip-debug --compress=1  configure custom link arguments (--output must be omitted)
    $BP_JVM_JLINK_ENABLED        false                                                        enables running jlink tool to generate custom JRE
    $BP_JVM_TYPE                 JRE                                                          the JVM type - JDK or JRE
    $BP_JVM_VERSION              17                                                           the Java version
  Launch Configuration:
    $BPL_DEBUG_ENABLED           false                                                        enables Java remote debugging support
    $BPL_DEBUG_PORT              8000                                                         configure the remote debugging port
    $BPL_DEBUG_SUSPEND           false                                                        configure whether to suspend execution until a debugger has attached
    $BPL_HEAP_DUMP_PATH                                                                       write heap dumps on error to this path
    $BPL_JAVA_NMT_ENABLED        true                                                         enables Java Native Memory Tracking (NMT)
    $BPL_JAVA_NMT_LEVEL          summary                                                      configure level of NMT, summary or detail
    $BPL_JFR_ARGS                                                                             configure custom Java Flight Recording (JFR) arguments
    $BPL_JFR_ENABLED             false                                                        enables Java Flight Recording (JFR)
    $BPL_JMX_ENABLED             false                                                        enables Java Management Extensions (JMX)
    $BPL_JMX_PORT                5000                                                         configure the JMX port
    $BPL_JVM_HEAD_ROOM           0                                                            the headroom in memory calculation
    $BPL_JVM_LOADED_CLASS_COUNT  35% of classes                                               the number of loaded classes in memory calculation
    $BPL_JVM_THREAD_COUNT        250                                                          the number of threads in memory calculation
    $JAVA_TOOL_OPTIONS                                                                        the JVM launch flags
    Using buildpack default Java version 17
  BellSoft Liberica JDK 17.0.7: Contributing to layer
    Downloading from https://github.com/bell-sw/Liberica/releases/download/17.0.7+7/bellsoft-jdk17.0.7+7-linux-amd64.tar.gz
    Verifying checksum
    Expanding to /layers/paketo-buildpacks_bellsoft-liberica/jdk
    Adding 137 container CA certificates to JVM truststore
    Writing env.build/JAVA_HOME.override
    Writing env.build/JDK_HOME.override
  BellSoft Liberica JRE 17.0.7: Contributing to layer
    Downloading from https://github.com/bell-sw/Liberica/releases/download/17.0.7+7/bellsoft-jre17.0.7+7-linux-amd64.tar.gz
    Verifying checksum
    Expanding to /layers/paketo-buildpacks_bellsoft-liberica/jre
    Adding 137 container CA certificates to JVM truststore
    Writing env.launch/BPI_APPLICATION_PATH.default
    Writing env.launch/BPI_JVM_CACERTS.default
    Writing env.launch/BPI_JVM_CLASS_COUNT.default
    Writing env.launch/BPI_JVM_SECURITY_PROVIDERS.default
    Writing env.launch/JAVA_HOME.default
    Writing env.launch/JAVA_TOOL_OPTIONS.append
    Writing env.launch/JAVA_TOOL_OPTIONS.delim
    Writing env.launch/MALLOC_ARENA_MAX.default
  Launch Helper: Contributing to layer
    Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/active-processor-count
    Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/java-opts
    Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/jvm-heap
    Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/link-local-dns
    Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/memory-calculator
    Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/security-providers-configurer
    Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/jmx
    Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/jfr
    Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/security-providers-classpath-9
    Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/debug-9
    Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/nmt
    Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/openssl-certificate-loader
  Java Security Properties: Contributing to layer
    Writing env.launch/JAVA_SECURITY_PROPERTIES.default
    Writing env.launch/JAVA_TOOL_OPTIONS.append
    Writing env.launch/JAVA_TOOL_OPTIONS.delim

Paketo Buildpack for Syft 1.31.0
  https://github.com/paketo-buildpacks/syft
    Downloading from https://github.com/anchore/syft/releases/download/v0.83.0/syft_0.83.0_linux_amd64.tar.gz
    Verifying checksum
    Writing env.build/SYFT_CHECK_FOR_APP_UPDATE.default

Paketo Buildpack for Quarkus 0.2.0
  https://github.com/paketo-buildpacks/quarkus
  Build Configuration:
    $BP_MAVEN_POM_FILE  pom.xml  the location of the main pom.xml file, relative to the application root
    Writing env.build/BP_MAVEN_BUILD_ARGUMENTS.default
    Writing env.build/BP_MAVEN_BUILT_ARTIFACT.default
  4 application slices

Paketo Buildpack for Maven 6.15.4
  https://github.com/paketo-buildpacks/maven
  Build Configuration:
    $BP_EXCLUDE_FILES                                                                                                                           colon separated list of glob patterns, matched source files are removed
    $BP_INCLUDE_FILES                                                                                                                           colon separated list of glob patterns, matched source files are included
    $BP_JAVA_INSTALL_NODE                 false                                                                                                 whether to install Yarn/Node binaries based on the presence of a package.json or yarn.lock file
    $BP_MAVEN_ACTIVE_PROFILES                                                                                                                   the active profiles (comma separated: such as: p1,!p2,?p3) to pass to Maven
    $BP_MAVEN_ADDITIONAL_BUILD_ARGUMENTS                                                                                                        the additionnal arguments (appended to BP_MAVEN_BUILD_ARGUMENTS) to pass to Maven
    $BP_MAVEN_BUILD_ARGUMENTS             package -DskipTests=true -Dmaven.javadoc.skip=true -Dquarkus.package.type=fast-jar                    the arguments to pass to Maven
    $BP_MAVEN_BUILT_ARTIFACT              target/quarkus-app/lib/ target/quarkus-app/*.jar target/quarkus-app/app/ target/quarkus-app/quarkus/  the built application artifact explicitly.  Supersedes $BP_MAVEN_BUILT_MODULE
    $BP_MAVEN_BUILT_MODULE                                                                                                                      the module to find application artifact in
    $BP_MAVEN_DAEMON_ENABLED              false                                                                                                 use maven daemon
    $BP_MAVEN_POM_FILE                    pom.xml                                                                                               the location of the main pom.xml file, relative to the application root
    $BP_MAVEN_SETTINGS_PATH                                                                                                                     the path to a Maven settings file
    $BP_MAVEN_VERSION                     3                                                                                                     the Maven version
    $BP_NODE_PROJECT_PATH                                                                                                                       configure a project subdirectory to look for `package.json` and `yarn.lock` files
    Creating cache directory /home/cnb/.m2
  Compiled Application: Contributing to layer
    Executing mvnw --batch-mode package -DskipTests=true -Dmaven.javadoc.skip=true -Dquarkus.package.type=fast-jar
      [INFO] Scanning for projects...
    
      [WARNING] Checksum validation failed, expected 2811ba27a71a8bda0602161ffe2f6e1429da8068 but is 36257165a0945753efb3f9d473d86c6f4c6c6f6e from central for https://repo.maven.apache.org/maven2/org/jboss/arquillian/arquillian-bom/1.7.0.Final/arquillian-bom-1.7.0.Final.pom
      [WARNING] Could not validate integrity of download from https://repo.maven.apache.org/maven2/org/jboss/arquillian/arquillian-bom/1.7.0.Final/arquillian-bom-1.7.0.Final.pom
      org.eclipse.aether.transfer.ChecksumFailureException: Checksum validation failed, expected 2811ba27a71a8bda0602161ffe2f6e1429da8068 but is 36257165a0945753efb3f9d473d86c6f4c6c6f6e
          at org.eclipse.aether.connector.basic.ChecksumValidator.validateExternalChecksums (ChecksumValidator.java:174)
          at org.eclipse.aether.connector.basic.ChecksumValidator.validate (ChecksumValidator.java:103)
          at org.eclipse.aether.connector.basic.BasicRepositoryConnector$GetTaskRunner.runTask (BasicRepositoryConnector.java:460)
          at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run (BasicRepositoryConnector.java:364)
          at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run (RunnableErrorForwarder.java:75)
          at org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute (BasicRepositoryConnector.java:628)
          at org.eclipse.aether.connector.basic.BasicRepositoryConnector.get (BasicRepositoryConnector.java:262)
          at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads (DefaultArtifactResolver.java:514)
          at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve (DefaultArtifactResolver.java:402)
          at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts (DefaultArtifactResolver.java:229)
          at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact (DefaultArtifactResolver.java:207)
          at org.apache.maven.repository.internal.DefaultModelResolver.resolveModel (DefaultModelResolver.java:172)
          at org.apache.maven.model.building.DefaultModelBuilder.importDependencyManagement (DefaultModelBuilder.java:1272)
          at org.apache.maven.model.building.DefaultModelBuilder.build (DefaultModelBuilder.java:481)
          at org.apache.maven.model.building.DefaultModelBuilder.build (DefaultModelBuilder.java:437)
          at org.apache.maven.model.building.DefaultModelBuilder.build (DefaultModelBuilder.java:252)
          at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom (DefaultArtifactDescriptorReader.java:297)
          at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor (DefaultArtifactDescriptorReader.java:175)
          at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.resolveCachedArtifactDescriptor (DefaultDependencyCollector.java:538)
          at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.getArtifactDescriptorResult (DefaultDependencyCollector.java:523)
          at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.processDependency (DefaultDependencyCollector.java:410)
          at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.processDependency (DefaultDependencyCollector.java:362)
          at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.process (DefaultDependencyCollector.java:349)
          at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.doRecurse (DefaultDependencyCollector.java:506)
          at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.processDependency (DefaultDependencyCollector.java:458)
          at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.processDependency (DefaultDependencyCollector.java:362)
          at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.process (DefaultDependencyCollector.java:349)
          at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.doRecurse (DefaultDependencyCollector.java:506)
          at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.processDependency (DefaultDependencyCollector.java:458)
          at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.processDependency (DefaultDependencyCollector.java:362)
          at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.process (DefaultDependencyCollector.java:349)
          at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.doRecurse (DefaultDependencyCollector.java:506)
          at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.processDependency (DefaultDependencyCollector.java:458)
          at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.processDependency (DefaultDependencyCollector.java:362)
          at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.process (DefaultDependencyCollector.java:349)
          at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.doRecurse (DefaultDependencyCollector.java:506)
          at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.processDependency (DefaultDependencyCollector.java:458)
          at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.processDependency (DefaultDependencyCollector.java:362)
          at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.process (DefaultDependencyCollector.java:349)
          at org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector.collectDependencies (DefaultDependencyCollector.java:254)
          at org.eclipse.aether.internal.impl.DefaultRepositorySystem.collectDependencies (DefaultRepositorySystem.java:284)
          at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve (DefaultProjectDependenciesResolver.java:170)
          at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies (LifecycleDependencyResolver.java:243)
          at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies (LifecycleDependencyResolver.java:147)
          at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved (MojoExecutor.java:248)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:202)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
          at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
          at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
          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:972)
          at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
          at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
          at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
          at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
          at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke (Method.java:568)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
          at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
          at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
          at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
          at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
          at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke (Method.java:568)
          at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:47)
          at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:156)
          at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:72)
      [WARNING] Checksum validation failed, expected 2811ba27a71a8bda0602161ffe2f6e1429da8068 but is 36257165a0945753efb3f9d473d86c6f4c6c6f6e from central for https://repo.maven.apache.org/maven2/org/jboss/arquillian/arquillian-bom/1.7.0.Final/arquillian-bom-1.7.0.Final.pom
    
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] Copying 1 resource
      [INFO] 
      [INFO] --- quarkus-maven-plugin:3.1.1.Final:generate-code (default) @ nelligan-auto-renew ---
      [INFO] Building jar: /workspace/target/nelligan-auto-renew-1.0.0-SNAPSHOT.jar
      [INFO] 
      [INFO] --- quarkus-maven-plugin:3.1.1.Final:build (default) @ nelligan-auto-renew ---
      [INFO] [io.quarkus.deployment.QuarkusAugmentor] Quarkus augmentation completed in 1487ms
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time:  35.357 s
      [INFO] Finished at: 2023-06-14T00:44:10Z
      [INFO] ------------------------------------------------------------------------
      
  Removing source code
  Restoring multiple artifacts

Paketo Buildpack for Executable JAR 6.7.3
  https://github.com/paketo-buildpacks/executable-jar
  Process types:
    executable-jar: java -jar /workspace/lib/main/io.smallrye.jandex-3.1.1.jar (direct)
    task:           java -jar /workspace/lib/main/io.smallrye.jandex-3.1.1.jar (direct)
    web:            java -jar /workspace/lib/main/io.smallrye.jandex-3.1.1.jar (direct)
===> EXPORTING
Adding layer 'paketo-buildpacks/ca-certificates:helper'
Adding layer 'paketo-buildpacks/bellsoft-liberica:helper'
Adding layer 'paketo-buildpacks/bellsoft-liberica:java-security-properties'
Adding layer 'paketo-buildpacks/bellsoft-liberica:jre'
Adding layer 'buildpacksio/lifecycle:launch.sbom'
Adding 5/5 app layer(s)
Adding layer 'buildpacksio/lifecycle:launcher'
Adding layer 'buildpacksio/lifecycle:config'
Adding layer 'buildpacksio/lifecycle:process-types'
Adding label 'io.buildpacks.lifecycle.metadata'
Adding label 'io.buildpacks.build.metadata'
Adding label 'io.buildpacks.project.metadata'
Setting default process type 'web'
Saving test-image...
*** Images (f9b3248c3d51):
      test-image
Adding cache layer 'paketo-buildpacks/bellsoft-liberica:jdk'
Adding cache layer 'paketo-buildpacks/syft:syft'
Adding cache layer 'paketo-buildpacks/maven:application'
Adding cache layer 'paketo-buildpacks/maven:cache'
Adding cache layer 'buildpacksio/lifecycle:cache.sbom'
Successfully built image test-image

I have removed the thousdans of Downloading lines from Maven output; also you'll notice an issue downloading an artifact, but that does not seem to harm the build 🤷

 pack inspect test-image                           
Inspecting image: test-image

REMOTE:
(not present)

LOCAL:

Stack: io.paketo.stacks.tiny

Base Image:
  Reference: cf6e761b103b4262e6125f0fcbc3fbbea1f61807dfe5558c6830b0dd3070439a
  Top Layer: sha256:ddfddeacc2c4fddeb174fa918cc1e9f5b8c72722bf47293448b6e3402b5de9f5

Run Images:
  index.docker.io/paketobuildpacks/run:tiny-cnb
  gcr.io/paketo-buildpacks/run:tiny-cnb

Buildpacks:
  ID                                         VERSION        HOMEPAGE
  paketo-buildpacks/ca-certificates          3.6.2          https://github.com/paketo-buildpacks/ca-certificates
  paketo-buildpacks/bellsoft-liberica        10.2.4         https://github.com/paketo-buildpacks/bellsoft-liberica
  paketo-buildpacks/syft                     1.31.0         https://github.com/paketo-buildpacks/syft
  paketo-buildpacks/quarkus                  0.2.0          https://github.com/paketo-buildpacks/quarkus
  paketo-buildpacks/maven                    6.15.4         https://github.com/paketo-buildpacks/maven
  paketo-buildpacks/executable-jar           6.7.3          https://github.com/paketo-buildpacks/executable-jar

Processes:
  TYPE                  SHELL        COMMAND        ARGS                                                         WORK DIR
  web (default)                      java           -jar /workspace/lib/main/io.smallrye.jandex-3.1.1.jar        /workspace
  executable-jar                     java           -jar /workspace/lib/main/io.smallrye.jandex-3.1.1.jar        /workspace
  task                               java           -jar /workspace/lib/main/io.smallrye.jandex-3.1.1.jar        /workspace

@dmikusa
Copy link
Contributor

dmikusa commented Jul 7, 2023

Sorry for the delayed response. Is /workspace/lib/main/io.smallrye.jandex-3.1.1.jar the right JAR to execute the app? The executable-jar buildpack is picking that, mostly likely because it contains a Main-Class entry in MANIFEST.MF. It can sometimes happen that it picks the wrong JAR file. I'm suspicious because it's under /workspace/lib/.... You can also see in the previous output that it's running jandex on start and that is just not doing anything, which further supports the hypothesis that it's picking the wrong JAR.

Usage: jandex [-v] [-m] [-o file-name] <directory> | <jar>
        -or-
       jandex [-d] <index-file-name>
...

There is an issue to make the JAR it picks more configurable, but that's not been implemented yet. http://github.com/paketo-buildpacks/executable-jar/issues/206.

@anthonydahanne
Copy link
Member

anthonydahanne commented Jul 7, 2023

Yeah, that was probably it; it picked a random jar with a declared Main-Class.

once paketo-buildpacks/executable-jar#206 is fixed I suggest this issue becomes about having quarkus contribute the new env. variable so that execute-jar will choose to use the right jar

@dmikusa dmikusa changed the title Buildpack does not build image when invoked locally Have Quarkus buildpack set env variable to ensure executable-jar buildpack picks the correct JAR Jul 7, 2023
@dmikusa dmikusa added type:enhancement A general enhancement note:on-hold We can't start working on this issue yet labels Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
note:on-hold We can't start working on this issue yet type:enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants