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

mvn plugin build-image openj9 support #25561

Closed
paulux84 opened this issue Mar 9, 2021 · 10 comments
Closed

mvn plugin build-image openj9 support #25561

paulux84 opened this issue Mar 9, 2021 · 10 comments
Labels
status: duplicate A duplicate of another issue

Comments

@paulux84
Copy link

paulux84 commented Mar 9, 2021

Actually build-image use as default paketo-buildpacks/bellsoft-liberica:jre but can be really cool thing adding possibility to chose witch jre buildpack to use (for example paketo-buildpacks/eclipse-openj9)

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 9, 2021
@eddumelendez
Copy link
Contributor

eddumelendez commented Mar 9, 2021

@paulux84 spring-boot uses paketo buildpacks by default. In order to switch to eclipse-openj9 you can use the configuration below starting with 2.5

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<image>
						<builder>gcr.io/paketo-buildpacks/builder:base</builder>
						<buildpacks>
							<buildpack>gcr.io/paketo-buildpacks/eclipse-openj9:latest</buildpack>
							<buildpack>gcr.io/paketo-buildpacks/executable-jar:latest</buildpack>
							<buildpack>gcr.io/paketo-buildpacks/spring-boot:latest</buildpack>
						</buildpacks>
						<pullPolicy>IF_NOT_PRESENT</pullPolicy>
					</image>
				</configuration>
			</plugin>
		</plugins>
	</build>

@scottfrederick
Copy link
Contributor

Closing as a duplicate of #21722.

@scottfrederick scottfrederick added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 9, 2021
@paulux84
Copy link
Author

hi @eddumelendez, thanks for the reply, but in this way i must specify all the buildpacks instead i suggest a way to selective substitute dafault buildpacks

@paulux84
Copy link
Author

paulux84 commented Mar 10, 2021

@paulux84 spring-boot uses paketo buildpacks by default. In order to switch to eclipse-openj9 you can use the configuration below starting with 2.5

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<image>
						<builder>gcr.io/paketo-buildpacks/builder:base</builder>
						<buildpacks>
							<buildpack>gcr.io/paketo-buildpacks/eclipse-openj9:latest</buildpack>
							<buildpack>gcr.io/paketo-buildpacks/executable-jar:latest</buildpack>
							<buildpack>gcr.io/paketo-buildpacks/spring-boot:latest</buildpack>
						</buildpacks>
						<pullPolicy>IF_NOT_PRESENT</pullPolicy>
					</image>
				</configuration>
			</plugin>
		</plugins>
	</build>

p.s. if i use this configuration (spring-boot-strarter-parent:2.5.0-M2) i get ERROR: No buildpack groups passed detection...while using manual pack command all detectors pass

@wilkinsona
Copy link
Member

That's been fixed in #25378. The change is available in 2.5.0-SNAPSHOT from https://repo.spring.io/snapshot and it'll be in next week's M3 release.

@scottfrederick
Copy link
Contributor

in this way i must specify all the buildpacks instead i suggest a way to selective substitute dafault buildpacks

This is consistent with the design of the pack CLI. By design, platforms like the pack CLI and the Spring Boot build plugins don't have deep knowledge of the builder that is being used, which buildpacks are included in the builder, or what role each buildpack plays in building an image. The Paketo builder is the default used by the Boot plugins, but any CNB-compatible builder can be used.

The minimal configuration to override the choice of JVM provider with the Paketo builder would be this:

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<image>
						<buildpacks>
							<buildpack>gcr.io/paketo-buildpacks/eclipse-openj9:latest</buildpack>
							<buildpack>paketo-buildpacks/java</buildpack>
						</buildpacks>
					</image>
				</configuration>
			</plugin>
		</plugins>
	</build>

This puts the eclipse-openj9 buildpack ahead of the bellsoft-liberica buildpack that is included in paketo-buildpacks/java, which results in bellsoft-liberica backing off because a JVM is already provided. All other buildpacks included in paketo-buildpacks/javathat don't provide a JVM are still invoked as usual.

If you need more fine-grained control of the list of buildpacks that are involved and the order they are invoked without configuring it via the Spring Boot build plugin configuration, you should create a custom builder.

@paulux84
Copy link
Author

Really thanks for your explanation. Now is more clear for me how spring boot handle build-image...now i must wait the final release and other libs support (ex. spring cloud)
Thanks again :)
Have a nice day

@mancave
Copy link

mancave commented May 17, 2021

Can this feature also be implemented on the 2.4.x ?

@Been24
Copy link

Been24 commented Aug 24, 2021

in this way i must specify all the buildpacks instead i suggest a way to selective substitute dafault buildpacks

This is consistent with the design of the pack CLI. By design, platforms like the pack CLI and the Spring Boot build plugins don't have deep knowledge of the builder that is being used, which buildpacks are included in the builder, or what role each buildpack plays in building an image. The Paketo builder is the default used by the Boot plugins, but any CNB-compatible builder can be used.

The minimal configuration to override the choice of JVM provider with the Paketo builder would be this:

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<image>
						<buildpacks>
							<buildpack>gcr.io/paketo-buildpacks/eclipse-openj9:latest</buildpack>
							<buildpack>paketo-buildpacks/java</buildpack>
						</buildpacks>
					</image>
				</configuration>
			</plugin>
		</plugins>
	</build>

This puts the eclipse-openj9 buildpack ahead of the bellsoft-liberica buildpack that is included in paketo-buildpacks/java, which results in bellsoft-liberica backing off because a JVM is already provided. All other buildpacks included in paketo-buildpacks/javathat don't provide a JVM are still invoked as usual.

If you need more fine-grained control of the list of buildpacks that are involved and the order they are invoked without configuring it via the Spring Boot build plugin configuration, you should create a custom builder.

The minimal configuration caused an Invalid buildpack reference 'gcr.io/paketo-buildpacks/eclipse-openj9:latest' error in springboot 2.5.4

@scottfrederick
Copy link
Contributor

The minimal configuration caused an Invalid buildpack reference 'gcr.io/paketo-buildpacks/eclipse-openj9:latest' error in springboot 2.5.4

@Been24 The configuration using gcr.io/paketo-buildpacks/eclipse-openj9:latest still works for me. An "invalid buildpack reference" error could be caused by the Google Cloud Container Registry at gcr.io not being available from your location. There's nothing Spring Boot can do about this, as GCR is where the Paketo project chooses to publish the buildpack images. You might be able to pull or build the required image and publish it to an alternate registry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

7 participants