Merge lp:~sergiusens/snapcraft/maven into lp:~snappy-dev/snapcraft/core

Proposed by Sergio Schvezov
Status: Merged
Approved by: John Lenton
Approved revision: 251
Merged at revision: 249
Proposed branch: lp:~sergiusens/snapcraft/maven
Merge into: lp:~snappy-dev/snapcraft/core
Diff against target: 205 lines (+109/-5)
9 files modified
examples/tomcat-maven-webapp/snapcraft.yaml (+1/-1)
integration-tests/data/simple-maven/my-app/pom.xml (+18/-0)
integration-tests/data/simple-maven/my-app/src/main/java/com/canonical/testapp/App.java (+13/-0)
integration-tests/data/simple-maven/my-app/src/main/resources/META-INF/application.properties (+1/-0)
integration-tests/data/simple-maven/my-app/src/test/java/com/canonical/testapp/AppTest.java (+38/-0)
integration-tests/data/simple-maven/snapcraft.yaml (+15/-0)
integration-tests/units/jobs.pxu (+7/-0)
snapcraft/plugins/jdk.py (+0/-3)
snapcraft/plugins/maven.py (+16/-1)
To merge this branch: bzr merge lp:~sergiusens/snapcraft/maven
Reviewer Review Type Date Requested Status
John Lenton (community) Approve
Review via email: mp+274964@code.launchpad.net

Commit message

Add support for maven options

To post a comment you must log in.
lp:~sergiusens/snapcraft/maven updated
251. By Sergio Schvezov

Adding an integration test

Revision history for this message
John Lenton (chipaca) wrote :

lgtm!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'examples/tomcat-maven-webapp/snapcraft.yaml'
--- examples/tomcat-maven-webapp/snapcraft.yaml 2015-10-08 19:33:48 +0000
+++ examples/tomcat-maven-webapp/snapcraft.yaml 2015-10-20 01:49:22 +0000
@@ -19,7 +19,7 @@
19 source: git://github.com/lool/snappy-mvn-demo.git19 source: git://github.com/lool/snappy-mvn-demo.git
20 tomcat:20 tomcat:
21 plugin: tar-content21 plugin: tar-content
22 source: http://mirrors.ircam.fr/pub/apache/tomcat/tomcat-8/v8.0.27/bin/apache-tomcat-8.0.27.tar.gz22 source: http://mirrors.ircam.fr/pub/apache/tomcat/tomcat-8/v8.0.28/bin/apache-tomcat-8.0.28.tar.gz
23 local-files:23 local-files:
24 plugin: make24 plugin: make
25 source: .25 source: .
2626
=== added directory 'integration-tests/data/simple-maven'
=== added file 'integration-tests/data/simple-maven/icon.png'
=== added directory 'integration-tests/data/simple-maven/my-app'
=== added file 'integration-tests/data/simple-maven/my-app/pom.xml'
--- integration-tests/data/simple-maven/my-app/pom.xml 1970-01-01 00:00:00 +0000
+++ integration-tests/data/simple-maven/my-app/pom.xml 2015-10-20 01:49:22 +0000
@@ -0,0 +1,18 @@
1<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3 <modelVersion>4.0.0</modelVersion>
4 <groupId>com.canonical.testapp</groupId>
5 <artifactId>my-app</artifactId>
6 <packaging>jar</packaging>
7 <version>1.0-SNAPSHOT</version>
8 <name>my-app</name>
9 <url>http://maven.apache.org</url>
10 <dependencies>
11 <dependency>
12 <groupId>junit</groupId>
13 <artifactId>junit</artifactId>
14 <version>3.8.1</version>
15 <scope>test</scope>
16 </dependency>
17 </dependencies>
18</project>
019
=== added directory 'integration-tests/data/simple-maven/my-app/src'
=== added directory 'integration-tests/data/simple-maven/my-app/src/main'
=== added directory 'integration-tests/data/simple-maven/my-app/src/main/java'
=== added directory 'integration-tests/data/simple-maven/my-app/src/main/java/com'
=== added directory 'integration-tests/data/simple-maven/my-app/src/main/java/com/canonical'
=== added directory 'integration-tests/data/simple-maven/my-app/src/main/java/com/canonical/testapp'
=== added file 'integration-tests/data/simple-maven/my-app/src/main/java/com/canonical/testapp/App.java'
--- integration-tests/data/simple-maven/my-app/src/main/java/com/canonical/testapp/App.java 1970-01-01 00:00:00 +0000
+++ integration-tests/data/simple-maven/my-app/src/main/java/com/canonical/testapp/App.java 2015-10-20 01:49:22 +0000
@@ -0,0 +1,13 @@
1package com.canonical.testapp;
2
3/**
4 * Hello world!
5 *
6 */
7public class App
8{
9 public static void main( String[] args )
10 {
11 System.out.println( "Hello World!" );
12 }
13}
014
=== added directory 'integration-tests/data/simple-maven/my-app/src/main/resources'
=== added directory 'integration-tests/data/simple-maven/my-app/src/main/resources/META-INF'
=== added file 'integration-tests/data/simple-maven/my-app/src/main/resources/META-INF/application.properties'
--- integration-tests/data/simple-maven/my-app/src/main/resources/META-INF/application.properties 1970-01-01 00:00:00 +0000
+++ integration-tests/data/simple-maven/my-app/src/main/resources/META-INF/application.properties 2015-10-20 01:49:22 +0000
@@ -0,0 +1,1 @@
1application.hello=${application.hello}
02
=== added directory 'integration-tests/data/simple-maven/my-app/src/test'
=== added directory 'integration-tests/data/simple-maven/my-app/src/test/java'
=== added directory 'integration-tests/data/simple-maven/my-app/src/test/java/com'
=== added directory 'integration-tests/data/simple-maven/my-app/src/test/java/com/canonical'
=== added directory 'integration-tests/data/simple-maven/my-app/src/test/java/com/canonical/testapp'
=== added file 'integration-tests/data/simple-maven/my-app/src/test/java/com/canonical/testapp/AppTest.java'
--- integration-tests/data/simple-maven/my-app/src/test/java/com/canonical/testapp/AppTest.java 1970-01-01 00:00:00 +0000
+++ integration-tests/data/simple-maven/my-app/src/test/java/com/canonical/testapp/AppTest.java 2015-10-20 01:49:22 +0000
@@ -0,0 +1,38 @@
1package com.canonical.testapp;
2
3import junit.framework.Test;
4import junit.framework.TestCase;
5import junit.framework.TestSuite;
6
7/**
8 * Unit test for simple App.
9 */
10public class AppTest
11 extends TestCase
12{
13 /**
14 * Create the test case
15 *
16 * @param testName name of the test case
17 */
18 public AppTest( String testName )
19 {
20 super( testName );
21 }
22
23 /**
24 * @return the suite of tests being tested
25 */
26 public static Test suite()
27 {
28 return new TestSuite( AppTest.class );
29 }
30
31 /**
32 * Rigourous Test :-)
33 */
34 public void testApp()
35 {
36 assertTrue( false );
37 }
38}
039
=== added file 'integration-tests/data/simple-maven/snapcraft.yaml'
--- integration-tests/data/simple-maven/snapcraft.yaml 1970-01-01 00:00:00 +0000
+++ integration-tests/data/simple-maven/snapcraft.yaml 2015-10-20 01:49:22 +0000
@@ -0,0 +1,15 @@
1name: simple-maven
2version: 0
3vendor: Vendor <email@example.com>
4summary: test maven builds
5description: |
6 Test maven builds and options. If the tests aren't skipped we will run into
7 the assertTrue ( false ) statement and the build will fail.
8icon: icon.png
9
10parts:
11 m:
12 plugin: maven
13 source: my-app
14 maven-options:
15 - -DskipTests
016
=== modified file 'integration-tests/units/jobs.pxu'
--- integration-tests/units/jobs.pxu 2015-10-15 22:08:19 +0000
+++ integration-tests/units/jobs.pxu 2015-10-20 01:49:22 +0000
@@ -135,6 +135,13 @@
135 test "$(./stage/bin/test)" = "Hello world"135 test "$(./stage/bin/test)" = "Hello world"
136flags: simple has-leftovers136flags: simple has-leftovers
137137
138id: snapcraft/normal/simple-maven
139command:
140 set -ex
141 cp -rT $PLAINBOX_PROVIDER_DATA/simple-maven .
142 ${SNAPCRAFT} build
143flags: simple has-leftovers
144
138id: snapcraft/normal/simple-scons145id: snapcraft/normal/simple-scons
139command:146command:
140 set -ex147 set -ex
141148
=== modified file 'snapcraft/plugins/jdk.py'
--- snapcraft/plugins/jdk.py 2015-10-17 02:25:13 +0000
+++ snapcraft/plugins/jdk.py 2015-10-20 01:49:22 +0000
@@ -23,9 +23,6 @@
23 super().__init__(name, options)23 super().__init__(name, options)
24 self.stage_packages.append('default-jdk')24 self.stage_packages.append('default-jdk')
2525
26 def pull(self):
27 return True
28
29 def env(self, root):26 def env(self, root):
30 return ['JAVA_HOME=%s/usr/lib/jvm/default-java' % root,27 return ['JAVA_HOME=%s/usr/lib/jvm/default-java' % root,
31 'PATH=%s/usr/lib/jvm/default-java/bin:'28 'PATH=%s/usr/lib/jvm/default-java/bin:'
3229
=== modified file 'snapcraft/plugins/maven.py'
--- snapcraft/plugins/maven.py 2015-10-17 02:25:13 +0000
+++ snapcraft/plugins/maven.py 2015-10-20 01:49:22 +0000
@@ -28,6 +28,21 @@
2828
29class MavenPlugin(snapcraft.plugins.jdk.JdkPlugin):29class MavenPlugin(snapcraft.plugins.jdk.JdkPlugin):
3030
31 @classmethod
32 def schema(cls):
33 schema = super().schema()
34 schema['properties']['maven-options'] = {
35 'type': 'array',
36 'minitems': 1,
37 'uniqueItems': True,
38 'items': {
39 'type': 'string',
40 },
41 'default': [],
42 }
43
44 return schema
45
31 def __init__(self, name, options):46 def __init__(self, name, options):
32 super().__init__(name, options)47 super().__init__(name, options)
33 self.build_packages.append('maven')48 self.build_packages.append('maven')
@@ -35,7 +50,7 @@
35 def build(self):50 def build(self):
36 super().build()51 super().build()
3752
38 if not self.run(['mvn', 'package']):53 if not self.run(['mvn', 'package'] + self.options.maven_options):
39 return False54 return False
40 jarfiles = glob.glob(os.path.join(self.builddir, 'target', '*.jar'))55 jarfiles = glob.glob(os.path.join(self.builddir, 'target', '*.jar'))
41 warfiles = glob.glob(os.path.join(self.builddir, 'target', '*.war'))56 warfiles = glob.glob(os.path.join(self.builddir, 'target', '*.war'))

Subscribers

People subscribed via source and target branches