Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
fc78a8de
Commit
fc78a8de
authored
Jun 15, 2016
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.3.x'
parents
e4f95932
c808de00
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
4 deletions
+30
-4
RepackagingTests.java
...ava/org/springframework/boot/gradle/RepackagingTests.java
+11
-0
repackage.gradle
...ing-boot-gradle-tests/src/test/resources/repackage.gradle
+8
-1
RepackageTask.java
.../springframework/boot/gradle/repackage/RepackageTask.java
+11
-3
No files found.
spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/RepackagingTests.java
View file @
fc78a8de
...
...
@@ -163,6 +163,17 @@ public class RepackagingTests {
assertThat
(
isDevToolsJarIncluded
(
repackageFile
)).
isFalse
();
}
@Test
public
void
customRepackagingTaskWithOwnMainClassNameAnNoGlobalMainClassName
()
{
project
.
newBuild
().
forTasks
(
"clean"
,
"customRepackagedJarWithOwnMainClass"
)
.
withArguments
(
"-PbootVersion="
+
BOOT_VERSION
,
"-Prepackage=true"
,
"-PexcludeDevtools=false"
,
"-PnoMainClass=true"
)
.
run
();
File
buildLibs
=
new
File
(
"target/repackage/build/libs"
);
assertThat
(
new
File
(
buildLibs
,
"custom.jar"
).
exists
()).
isTrue
();
assertThat
(
new
File
(
buildLibs
,
"custom.jar.original"
).
exists
()).
isTrue
();
}
private
boolean
isDevToolsJarIncluded
(
File
repackageFile
)
throws
IOException
{
JarFile
jarFile
=
new
JarFile
(
repackageFile
);
try
{
...
...
spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/repackage.gradle
View file @
fc78a8de
...
...
@@ -23,7 +23,9 @@ dependencies {
}
springBoot
{
mainClass
=
'foo.bar.Baz'
if
(!
project
.
hasProperty
(
"noMainClass"
))
{
mainClass
=
'foo.bar.Baz'
}
excludeDevtools
=
Boolean
.
valueOf
(
project
.
excludeDevtools
)
}
...
...
@@ -50,3 +52,8 @@ task customRepackagedJar(type: BootRepackage, dependsOn: customJar) {
task
customRepackagedJarWithStringReference
(
type:
BootRepackage
,
dependsOn:
customJar
)
{
withJarTask
=
'customJar'
}
task
customRepackagedJarWithOwnMainClass
(
type:
BootRepackage
,
dependsOn:
customJar
)
{
withJarTask
=
customJar
mainClass
=
'foo.bar.Baz'
}
spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/repackage/RepackageTask.java
View file @
fc78a8de
...
...
@@ -254,8 +254,13 @@ public class RepackageTask extends DefaultTask {
.
property
(
"main"
);
}
}
getLogger
().
info
(
"Setting mainClass: "
+
mainClassName
);
repackager
.
setMainClass
(
mainClassName
);
if
(
mainClassName
!=
null
)
{
getLogger
().
info
(
"Setting mainClass: "
+
mainClassName
);
repackager
.
setMainClass
(
mainClassName
);
}
else
{
getLogger
().
info
(
"No mainClass configured"
);
}
}
private
String
getMainClassNameProperty
()
{
...
...
@@ -264,7 +269,10 @@ public class RepackageTask extends DefaultTask {
}
ExtraPropertiesExtension
extraProperties
=
(
ExtraPropertiesExtension
)
getProject
()
.
getExtensions
().
getByName
(
"ext"
);
return
(
String
)
extraProperties
.
get
(
"mainClassName"
);
if
(
extraProperties
.
has
(
"mainClassName"
))
{
return
(
String
)
extraProperties
.
get
(
"mainClassName"
);
}
return
null
;
}
private
LaunchScript
getLaunchScript
()
throws
IOException
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment