Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"groups": [
{ "name": "camel.jbang", "description": "Camel CLI configurations" }
{ "name": "camel.jbang", "description": "Camel JBang configurations" }
],
"properties": [
{ "name": "camel.jbang.camel-version", "required": false, "description": "The version of Apache Camel to use", "type": "string", "javaType": "String", "secret": false },
Expand All @@ -23,7 +23,7 @@
{ "name": "camel.jbang.javaVersion", "required": false, "description": "Java version", "type": "enum", "javaType": "String", "defaultValue": "21", "secret": false, "enum": [ "21" ] },
{ "name": "camel.jbang.jfr", "required": false, "description": "Enables Java Flight Recorder saving recording to disk on exit", "type": "boolean", "javaType": "boolean", "defaultValue": false, "secret": false },
{ "name": "camel.jbang.jfr-profile", "required": false, "description": "Java Flight Recorder profile to use (such as default or profile)", "type": "string", "javaType": "String", "defaultValue": "default", "secret": false },
{ "name": "camel.jbang.jib-maven-plugin-version", "required": false, "description": "Version to use for jib-maven-plugin if exporting to camel-main and have Kubernetes enabled (jkube.xxx options)", "label": "kubernetes", "type": "string", "javaType": "String", "defaultValue": "3.4.5", "secret": false },
{ "name": "camel.jbang.jib-maven-plugin-version", "required": false, "description": "Version to use for jib-maven-plugin when exporting the application", "label": "maven", "type": "string", "javaType": "String", "defaultValue": "3.5.1", "secret": false },
{ "name": "camel.jbang.jkube-maven-plugin-version", "required": false, "description": "Version to use for jkube-maven-plugin if exporting to camel-main and have Kubernetes enabled (jkube.xxx options)", "label": "kubernetes", "type": "string", "javaType": "String", "defaultValue": "1.19.0", "secret": false },
{ "name": "camel.jbang.jkubeFiles", "required": false, "description": "Resource YAML fragments for Kubernetes using Eclipse JKube tool (Use commas to separate multiple files).", "label": "kubernetes", "type": "string", "javaType": "String", "secret": false },
{ "name": "camel.jbang.kameletsVersion", "required": false, "description": "Apache Camel Kamelets version. By default the Kamelets are the same version as Camel.", "type": "string", "javaType": "String", "secret": false },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The camel.jbang supports 48 options, which are listed below.
| *camel.jbang.javaVersion* | Java version | 21 | String
| *camel.jbang.jfr* | Enables Java Flight Recorder saving recording to disk on exit | false | boolean
| *camel.jbang.jfr-profile* | Java Flight Recorder profile to use (such as default or profile) | default | String
| *camel.jbang.jib-maven-plugin-version* | Version to use for jib-maven-plugin if exporting to camel-main and have Kubernetes enabled (jkube.xxx options) | 3.4.5 | String
| *camel.jbang.jib-maven-plugin-version* | Version to use for jib-maven-plugin when exporting the application | 3.5.1 | String
| *camel.jbang.jkube-maven-plugin-version* | Version to use for jkube-maven-plugin if exporting to camel-main and have Kubernetes enabled (jkube.xxx options) | 1.19.0 | String
| *camel.jbang.jkubeFiles* | Resource YAML fragments for Kubernetes using Eclipse JKube tool (Use commas to separate multiple files). | | String
| *camel.jbang.kameletsVersion* | Apache Camel Kamelets version. By default the Kamelets are the same version as Camel. | | String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{ "name": "camel.jbang.javaVersion", "required": false, "description": "Java version", "type": "enum", "javaType": "String", "defaultValue": "21", "secret": false, "enum": [ "21" ] },
{ "name": "camel.jbang.jfr", "required": false, "description": "Enables Java Flight Recorder saving recording to disk on exit", "type": "boolean", "javaType": "boolean", "defaultValue": false, "secret": false },
{ "name": "camel.jbang.jfr-profile", "required": false, "description": "Java Flight Recorder profile to use (such as default or profile)", "type": "string", "javaType": "String", "defaultValue": "default", "secret": false },
{ "name": "camel.jbang.jib-maven-plugin-version", "required": false, "description": "Version to use for jib-maven-plugin if exporting to camel-main and have Kubernetes enabled (jkube.xxx options)", "label": "kubernetes", "type": "string", "javaType": "String", "defaultValue": "3.4.5", "secret": false },
{ "name": "camel.jbang.jib-maven-plugin-version", "required": false, "description": "Version to use for jib-maven-plugin when exporting the application", "label": "maven", "type": "string", "javaType": "String", "defaultValue": "3.5.1", "secret": false },
{ "name": "camel.jbang.jkube-maven-plugin-version", "required": false, "description": "Version to use for jkube-maven-plugin if exporting to camel-main and have Kubernetes enabled (jkube.xxx options)", "label": "kubernetes", "type": "string", "javaType": "String", "defaultValue": "1.19.0", "secret": false },
{ "name": "camel.jbang.jkubeFiles", "required": false, "description": "Resource YAML fragments for Kubernetes using Eclipse JKube tool (Use commas to separate multiple files).", "label": "kubernetes", "type": "string", "javaType": "String", "secret": false },
{ "name": "camel.jbang.kameletsVersion", "required": false, "description": "Apache Camel Kamelets version. By default the Kamelets are the same version as Camel.", "type": "string", "javaType": "String", "secret": false },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,7 @@ protected static String jibMavenPluginVersion(Path settings, Properties prop) {
// ignore
}
}
return answer != null ? answer : "3.4.5";
return answer != null ? answer : "3.5.1";
}

protected static String jkubeMavenPluginVersion(Path settings, Properties props) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ private void createMavenPom(Path settings, Path profile, Path pom, Set<String> d
model.put("BuildProperties", formatBuildProperties());
model.put("Repositories", buildRepositoryList(repos));
model.put("Dependencies", buildDependencyList(deps));
model.put("JibMavenPluginVersion", jibMavenPluginVersion(settings, prop));

// kubernetes/docker properties
enrichKubernetesModel(model, settings, profile);
Expand Down Expand Up @@ -254,7 +255,6 @@ private void enrichKubernetesModel(Map<String, Object> model, Path settings, Pat
model.put("hasJib", jib || jkube);
model.put("hasJkube", jkube);
if (jib || jkube) {
model.put("JibMavenPluginVersion", jibMavenPluginVersion(settings, prop));
model.put("hasJibFromAuth",
prop.stringPropertyNames().stream().anyMatch(s -> s.startsWith("jib.from.auth.")));
model.put("hasJibToAuth",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ private void createMavenPom(Path settings, Path pom, Set<String> deps) throws Ex
model.put("BuildProperties", formatBuildProperties());
model.put("Repositories", buildRepositoryList(repos));
model.put("Dependencies", depList);
model.put("JibMavenPluginVersion", jibMavenPluginVersion(settings, prop));

String context = TemplateHelper.processTemplate(pomTemplateName, model);
Files.writeString(pom, context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ private void createMavenPom(Path settings, Path profile, Path pom, Set<String> d
model.put("BuildProperties", formatBuildProperties());
model.put("Repositories", buildRepositoryList(repos));
model.put("Dependencies", depList);
model.put("JibMavenPluginVersion", jibMavenPluginVersion(settings, prop));

String context = TemplateHelper.processTemplate(pomTemplateName, model);
IOHelper.writeText(context, Files.newOutputStream(pom));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ public final class CamelJBangConstants {
@Metadata(description = "Additional dependencies for Quarkus runtime only", javaType = "String")
public static final String DEPENDENCIES_QUARKUS = "camel.jbang.dependencies.quarkus";

@Metadata(description = "Version to use for jib-maven-plugin if exporting to camel-main and have Kubernetes enabled (jkube.xxx options)",
javaType = "String", defaultValue = "3.4.5", label = "kubernetes")
@Metadata(description = "Version to use for jib-maven-plugin when exporting the application",
javaType = "String", defaultValue = "3.5.1", label = "maven")
public static final String JIB_MAVEN_PLUGIN_VERSION = "camel.jbang.jib-maven-plugin-version";

@Metadata(description = "Version to use for jkube-maven-plugin if exporting to camel-main and have Kubernetes enabled (jkube.xxx options)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,49 @@
</dependency>
</dependencies>
</profile>

<profile>
<id>jib</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>[=JibMavenPluginVersion]</version>
<configuration>
<allowInsecureRegistries>true</allowInsecureRegistries>
<extraDirectories>
<paths>
<path>
<from>${project.build.directory}</from>
<into>/deployments</into>
<includes>
<include>${project.build.finalName}.jar</include>
</includes>
</path>
</paths>
<permissions>
<permission>
<file>/deployments/${project.build.finalName}.jar</file>
<mode>644</mode>
</permission>
</permissions>
</extraDirectories>
<container>
<entrypoint>
<arg>java</arg>
<arg>-jar</arg>
<arg>/deployments/${project.build.finalName}.jar</arg>
</entrypoint>
</container>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,43 @@
<skipITs>false</skipITs>
<quarkus.package.type>native</quarkus.package.type>
</properties>

<!-- NOTE: the Jib specific for native profile is meant to work with a native (quarkus.package.jar.type property = native) -->
<build>
<plugins>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>[=JibMavenPluginVersion]</version>
<configuration>
<allowInsecureRegistries>true</allowInsecureRegistries>
<extraDirectories>
<paths>
<path>
<from>${project.build.directory}</from>
<into>/deployments</into>
<includes>
<include>${project.build.finalName}-runner</include>
</includes>
</path>
</paths>
<permissions>
<permission>
<file>/deployments/${project.build.finalName}-runner</file>
<mode>755</mode>
</permission>
</permissions>
</extraDirectories>
<container>
<entrypoint>
<arg>/deployments/${project.build.finalName}-runner</arg>
</entrypoint>
</container>
</configuration>
</plugin>
</plugins>
</build>

</profile>
<profile>
<id>camel.debug</id>
Expand Down Expand Up @@ -256,6 +293,53 @@
</plugins>
</build>
</profile>

<profile>
<!-- NOTE: the Jib is meant to work with a fat-jar (quarkus.package.jar.type property = uber-jar) -->
<id>jib</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<quarkus.package.jar.type>uber-jar</quarkus.package.jar.type>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>[=JibMavenPluginVersion]</version>
<configuration>
<allowInsecureRegistries>true</allowInsecureRegistries>
<extraDirectories>
<paths>
<path>
<from>${project.build.directory}</from>
<into>/deployments</into>
<includes>
<include>${project.build.finalName}-runner.jar</include>
</includes>
</path>
</paths>
<permissions>
<permission>
<file>/deployments/${project.build.finalName}-runner.jar</file>
<mode>644</mode>
</permission>
</permissions>
</extraDirectories>
<container>
<entrypoint>
<arg>java</arg>
<arg>-jar</arg>
<arg>/deployments/${project.build.finalName}-runner.jar</arg>
</entrypoint>
</container>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,22 @@ Once the application is published, you can run it directly from the container:
```bash
docker run -it [=ArtifactId]:[=Version]
```

## Create a container with Jib plugin

If you don't want to deal with Docker resources, you can use the `jib` profile. This tool works inside Maven and is in charge to build and push a container
out of the box. The profile is configured to produce an executable jar (regardless of the runtime chosen). You can provide any argument expected by the plugin:

```bash
mvn clean package jib:build -Pjib \
-Djib.to.image=my-registry.io/my-registry-org/my-container:latest \
-Djib.from.image=eclipse-temurin:21-jdk \
-Djib.container.user=1000
```

You can use any base image with a compatible JVM which provides a `java` executable in the path. Once the application is published,
you can run it directly from the container:

```bash
docker run my-registry.io/my-registry-org/my-container:latest
```
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,25 @@ Once the application is published, you can run it directly from the container:
docker run -it [=ArtifactId]:[=Version]
```

## Create a container with Jib plugin (JVM mode)

If you don't want to deal with Docker resources, you can use the `jib` profile. This tool works inside Maven and is in charge to build and push a container
out of the box. The profile is configured to produce an executable jar (regardless of the runtime chosen). You can provide any argument expected by the plugin:

```bash
mvn clean package jib:build -Pjib \
-Djib.to.image=my-registry.io/my-registry-org/my-container:latest \
-Djib.from.image=eclipse-temurin:21-jdk \
-Djib.container.user=1000
```

You can use any base image with a compatible JVM which provides a `java` executable in the path. Once the application is published,
you can run it directly from the container:

```bash
docker run my-registry.io/my-registry-org/my-container:latest
```

## Build the Maven project (Native mode)

```bash
Expand All @@ -81,3 +100,21 @@ Once the application is published, you can run it directly from the container:
```bash
docker run -it native-[=ArtifactId]:[=Version]
```

## Create a container with Jib plugin (Native mode)

If you don't want to deal with Docker resources, you can use the `jib` profile. This tool works inside Maven and is in charge to build and push a container
out of the box. The profile is configured to produce a native executable. You can provide any argument expected by the plugin:

```bash
mvn clean package jib:build -Pnative \
-Djib.to.image=my-registry.io/my-registry-org/my-container:latest \
-Djib.from.image=eclipse-temurin:21-jdk \
-Djib.container.user=1000
```

You can use any base image (even non JVM one) as the Quarkus native is an executable. Once the application is published, you can run it directly from the container:

```bash
docker run my-registry.io/my-registry-org/my-container:latest
```
Loading
Loading