-
Notifications
You must be signed in to change notification settings - Fork 441
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
- Loading branch information
Showing
7 changed files
with
121 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
.. include:: /common/craft-parts/reference/plugins/maven_plugin.rst | ||
:end-before: .. _maven-details-begin: | ||
|
||
Dependencies | ||
------------ | ||
|
||
The plugin expects Maven to be available on the system as the ``mvn`` | ||
executable, unless a part named ``maven-deps`` is defined. In this | ||
case, the plugin will assume that this part will stage the ``mvn`` | ||
executable to be used in the build step. | ||
|
||
Note that the Maven plugin does not make a Java runtime available in | ||
the target environment. In Snapcraft, the developer must stage the | ||
appropriate packages in order to be able to execute the application | ||
(unless the Java runtime is provided by a | ||
content snap). | ||
|
||
|
||
Example | ||
------- | ||
|
||
This is an example of a Snapcraft part using the Maven plugin. Note | ||
that the Maven and Java Runtime packages are listed as build packages, | ||
and the Java Runtime is staged to be part of the final payload:: | ||
|
||
mkpass: | ||
plugin: maven | ||
source: . | ||
build-packages: | ||
- openjdk-11-jre-headless | ||
- maven | ||
stage-packages: | ||
- openjdk-11-jre-headless | ||
|
||
.. include:: /common/craft-parts/reference/plugins/maven_plugin.rst | ||
:start-after: .. _maven-details-end: |
41 changes: 41 additions & 0 deletions
41
tests/spread/plugins/craft-parts/build-and-run-hello/maven-hello/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.example</groupId> | ||
<artifactId>hello</artifactId> | ||
<version>1.0</version> | ||
|
||
<name>hello</name> | ||
<description>A test project</description> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.release>11</maven.compiler.release> | ||
</properties> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<version>3.1.0</version> | ||
<configuration> | ||
<archive> | ||
<manifest> | ||
<addClasspath>true</addClasspath> | ||
<classpathPrefix>lib/</classpathPrefix> | ||
<mainClass>com.example.hello.Main</mainClass> | ||
</manifest> | ||
</archive> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.10.1</version> | ||
<configuration> | ||
<release>${maven.compiler.release}</release> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
30 changes: 30 additions & 0 deletions
30
tests/spread/plugins/craft-parts/build-and-run-hello/maven-hello/snap/snapcraft.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: maven-hello | ||
version: '1.0' | ||
summary: A test project | ||
description: | | ||
A test project for the maven plugin. It says hello. | ||
grade: stable # must be 'stable' to release into candidate/stable channels | ||
confinement: strict # use 'strict' once you have the right plugs and slots | ||
base: core22 | ||
|
||
lint: | ||
ignore: | ||
- library: | ||
- usr/lib/jvm/java-*/lib/*.so | ||
|
||
apps: | ||
maven-hello: | ||
command: bin/java -jar $SNAP/jar/hello-1.0.jar | ||
|
||
parts: | ||
hello: | ||
plugin: maven | ||
source: . | ||
build-packages: | ||
- openjdk-11-jre-headless | ||
- maven | ||
stage-packages: | ||
- openjdk-11-jre-headless | ||
prime: | ||
- -usr/lib/jvm/java-11-openjdk-*/lib/security/blacklisted.certs |
8 changes: 8 additions & 0 deletions
8
...ins/craft-parts/build-and-run-hello/maven-hello/src/main/java/com/example/hello/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.example.hello; | ||
|
||
|
||
public class Main { | ||
public static void main(String[] args) { | ||
System.out.println("hello world"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters