-
Notifications
You must be signed in to change notification settings - Fork 14
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
Maven dep #185
Conversation
Signed-off-by: Daniel Mikusa <[email protected]>
Signed-off-by: Daniel Mikusa <[email protected]>
1. By default, we now pass 2. By default, we provide three possible plans all of which only provide (one provides just maven, one provides just a built app, one provides maven and a built app) 3. If a pom.xml file exists, then we add a requires (jdk, syft, maven). This enables more scenarios: 1. All we do is install Maven. In this case, the build plan will provide maven and some other build pack will need to require it. 2. All we do is build with Maven. In this case, something else needs to provide maven & jdk. 3. Both install and build with Maven. This the classic case that we've been supporting. Signed-off-by: Daniel Mikusa <[email protected]>
Based on what is in the buildplan, the buildpack can now optionally install and optionally build. If `maven` is in the buildplan, then the buildpack will attempt to install or validate that Maven is installed and generate a command to run Maven. This comes in four forms: 1. Install Maven Daemon 2. Install Maven 3. Validate Maven Wrapper 4. Validate Maven on $PATH If `jvm-application-package` is in the buildplan, then the buildpack will attempt to perform a build with Maven. This uses the command from the previously installed or validated Maven. This enables four scenarios: 1. The buildpack installs & runs Maven (or Maven Daemon) 2. The buildpack runs Maven w/Maven Wrapper 2. The buildpack just installs Maven (or Maven Daemon) 3. The buildpack doesn't install Maven or use Maven Wrapper, but just runs Maven (Maven is provided through other means) Signed-off-by: Daniel Mikusa <[email protected]>
@AidanDelaney - FYI |
Signed-off-by: Daniel Mikusa <[email protected]>
This looks really good. The |
Don't we always still require a JDK?
I think auto numbering messed these points up, not a big deal but it's a very useful summary so good to have it correct if so |
Right now, we contribute three plans always:
The thought is that for the first option, some other buildpack would need to require Maven. Thus, we require For two and three, the thought is that you need a Does that sound good?
Fixed. |
- Added a case for default pom.xml location as well as a custom location when the file does not exist - Fixed descriptions & added context for additional grouping Signed-off-by: Daniel Mikusa <[email protected]>
Yes it makes sense 👍 My first point wasn't very clear, I just meant to clarify whether plan 1 makes this wording untrue: 'all of which only provide' since there is always a Requires for #1. Looks good though and the extra tests make the scenarios easier to follow now 🎉 |
@dmikusa this change broke the pipelines on our end due to the fact that the maven buildpack now detects always, without requiring JDK to be installed. We're building images from a pre-compiled jar file, and now we get the following error with the lates version of java buildpack:
$ pack build --builder paketobuildpacks/builder:base --buildpack gcr.io/paketo-buildpacks/java:latest --path target/demo-1.0.0.jar test-image
Previous image with name "test-image" not found
===> DETECTING
7 of 24 buildpacks participating
paketo-buildpacks/ca-certificates 3.4.0
paketo-buildpacks/bellsoft-liberica 9.7.0
paketo-buildpacks/syft 1.20.0
paketo-buildpacks/maven 6.9.0
paketo-buildpacks/executable-jar 6.5.0
paketo-buildpacks/dist-zip 5.4.0
paketo-buildpacks/spring-boot 5.19.0
===> RESTORING
===> BUILDING
Paketo Buildpack for CA Certificates 3.4.0
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 9.7.0
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 11 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 Java version 11 extracted from MANIFEST.MF
BellSoft Liberica JRE 11.0.16: Contributing to layer
Downloading from https://github.com/bell-sw/Liberica/releases/download/11.0.16.1+1/bellsoft-jre11.0.16.1+1-linux-amd64.tar.gz
Verifying checksum
Expanding to /layers/paketo-buildpacks_bellsoft-liberica/jre
Adding 127 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.20.0
https://github.com/paketo-buildpacks/syft
Downloading from https://github.com/anchore/syft/releases/download/v0.57.0/syft_0.57.0_linux_amd64.tar.gz
Verifying checksum
Writing env.build/SYFT_CHECK_FOR_APP_UPDATE.default
Paketo Buildpack for Maven 6.9.0
https://github.com/paketo-buildpacks/maven
Build Configuration:
$BP_MAVEN_BUILD_ARGUMENTS -Dmaven.test.skip=true --no-transfer-progress package the arguments to pass to Maven
$BP_MAVEN_BUILT_ARTIFACT target/*.[ejw]ar 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
Paketo Buildpack for Maven 6.9.0
unable to create application layer
failed to generate expected metadata
unable to determine java version
error executing 'javac -version':
Combined Output: :
unable to start PTY
exec: "javac": executable file not found in $PATH
ERROR: failed to build: exit status 1
ERROR: failed to build: executing lifecycle: failed with status code: 51 |
Thanks for the report. I thought we'd accounted for that case, but clearly not. We're going to roll this back temporarily. We need to add a bit more logic to the detect. |
PR [#185](#185) had an issue which caused problems when building from a WAR/JAR file. This PR adjusts the detection logic so that it'll work with WAR/JAR files as well as building from source. Signed-off-by: Daniel Mikusa <[email protected]>
@pbusko Sorry for the issue, I have PR #189 which should correct this. If you have a minute to test & give us some feedback, I have a docker image up with this fix. If you're using Spring Boot:
or the similar setting for Maven. |
@dmikusa sorry for late reply, I can confirm that when using |
Excellent! thanks! |
Summary
Changes to Detection:
pom.xml
file exists, then we add a requires (jdk, syft, maven).Changes to Build:
Based on what is in the buildplan, the buildpack can now optionally install and optionally build.
If
maven
is in the buildplan, then the buildpack will attempt to install or validate that Maven is installed and generate a command to run Maven.This can be done in four ways:
If
jvm-application-package
is in the buildplan, then the buildpack will attempt to perform a build with Maven. This uses the command from the previously installed or validated Maven.Use Cases
This enables four scenarios:
For 1.) & 2.) are the classic cases we've been supporting.
For 3.) & 4.) are the new cases that have been requested.
Resolves #159
Resolves #184