Skip to content

Commit 90c5091

Browse files
committed
test gradle: 'gradle fatjar' to create an executable jar
1 parent 64a613e commit 90c5091

2 files changed

Lines changed: 53 additions & 2 deletions

File tree

build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ subprojects {
1414
// maven { url 'http://192.168.160.187:8081/nexus/content/groups/public' }
1515
// maven { url 'https://maven.alfresco.com/nexus/content/groups/public' }
1616
maven { url 'http://archiva.dianrong.com/repository/mirror'}
17-
maven { url 'http://archiva.dianrong.com/repository/snapshots'}
17+
maven { url 'http://archiva.dianrong.com/repository/snapshots'}
18+
maven { url 'http://archiva.dianrong.com/repository/mirror'}
19+
maven { url 'http://archiva.dianrong.com/repository/snapshots'}
1820
mavenCentral()
1921
mavenLocal()
2022
jcenter()

test-springboot/build.gradle

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ war {
66
version = '0.5.0'
77
}
88
*/
9-
apply plugin: 'application'
9+
/*apply plugin: 'application'
1010
mainClassName = "com.figer.Main"
1111
1212
repositories {
@@ -32,5 +32,54 @@ jar {
3232
into('lib') {
3333
from configurations.runtime
3434
}
35+
}*/
36+
37+
buildscript {
38+
repositories {
39+
maven { url "http://repo.spring.io/snapshot" }
40+
maven { url "http://repo.spring.io/milestone" }
41+
maven { url 'http://archiva.dianrong.com/repository/mirror'}
42+
maven { url 'http://archiva.dianrong.com/repository/snapshots'}
43+
}
44+
45+
dependencies {
46+
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.1.RELEASE")
47+
classpath 'eu.appsatori:gradle-fatjar-plugin:0.3'
48+
}
49+
}
50+
51+
apply plugin: 'spring-boot'
52+
apply plugin: 'eu.appsatori.fatjar'
53+
54+
repositories {
55+
maven { url "http://repo.spring.io/snapshot" }
56+
maven { url "http://repo.spring.io/milestone" }
57+
}
58+
59+
dependencies {
60+
compile("org.springframework.boot:spring-boot-starter-web")
61+
testCompile("org.springframework.boot:spring-boot-starter-test")
62+
}
63+
64+
65+
jar {
66+
//from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
67+
manifest {
68+
attributes(
69+
'Class-Path': 'lib/' + configurations.runtime.collect { it.getName() }.join(' lib/'),
70+
'Main-Class': 'com.figer.Main'
71+
)
72+
}
73+
74+
into('lib') {
75+
from configurations.runtime
76+
}
77+
}
78+
79+
fatJar {
80+
81+
manifest {
82+
attributes 'Main-Class': 'com.figer.Main'
83+
}
3584
}
3685

0 commit comments

Comments
 (0)