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
2665ef06
Commit
2665ef06
authored
Jan 21, 2015
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.1.x'
parents
ca69156a
93b2a17f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
5 deletions
+50
-5
MultiProjectRepackagingTests.java
...ngframework/boot/gradle/MultiProjectRepackagingTests.java
+13
-0
build.gradle
...ces/multi-project-runtime-project-dependency/build.gradle
+22
-0
settings.gradle
.../multi-project-runtime-project-dependency/settings.gradle
+1
-0
RepackagePluginFeatures.java
...mework/boot/gradle/repackage/RepackagePluginFeatures.java
+14
-5
No files found.
spring-boot-integration-tests/src/test/java/org/springframework/boot/gradle/MultiProjectRepackagingTests.java
View file @
2665ef06
...
@@ -63,4 +63,17 @@ public class MultiProjectRepackagingTests {
...
@@ -63,4 +63,17 @@ public class MultiProjectRepackagingTests {
assertThat
(
jarFile
.
getEntry
(
"lib/foo.jar"
),
notNullValue
());
assertThat
(
jarFile
.
getEntry
(
"lib/foo.jar"
),
notNullValue
());
jarFile
.
close
();
jarFile
.
close
();
}
}
@Test
public
void
repackageWithRuntimeProjectDependency
()
throws
Exception
{
ProjectConnection
project
=
new
ProjectCreator
()
.
createProject
(
"multi-project-runtime-project-dependency"
);
project
.
newBuild
().
forTasks
(
"clean"
,
"build"
)
.
withArguments
(
"-PbootVersion="
+
BOOT_VERSION
).
run
();
File
buildLibs
=
new
File
(
"target/multi-project-runtime-project-dependency/projectA/build/libs"
);
JarFile
jarFile
=
new
JarFile
(
new
File
(
buildLibs
,
"projectA.jar"
));
assertThat
(
jarFile
.
getEntry
(
"lib/projectB.jar"
),
notNullValue
());
jarFile
.
close
();
}
}
}
spring-boot-integration-tests/src/test/resources/multi-project-runtime-project-dependency/build.gradle
0 → 100644
View file @
2665ef06
buildscript
{
repositories
{
mavenLocal
()
}
dependencies
{
classpath
"org.springframework.boot:spring-boot-gradle-plugin:${project.bootVersion}"
}
}
project
(
':projectA'
)
{
apply
plugin:
'spring-boot'
dependencies
{
runtime
project
(
':projectB'
)
}
bootRepackage
{
mainClass
'com.foo.Bar'
}
}
project
(
':projectB'
)
{
apply
plugin:
'java'
}
\ No newline at end of file
spring-boot-integration-tests/src/test/resources/multi-project-runtime-project-dependency/settings.gradle
0 → 100644
View file @
2665ef06
include
'projectA'
,
'projectB'
\ No newline at end of file
spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/repackage/RepackagePluginFeatures.java
View file @
2665ef06
/*
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
5
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -22,9 +22,12 @@ import java.io.IOException;
...
@@ -22,9 +22,12 @@ import java.io.IOException;
import
org.gradle.api.Action
;
import
org.gradle.api.Action
;
import
org.gradle.api.Project
;
import
org.gradle.api.Project
;
import
org.gradle.api.Task
;
import
org.gradle.api.Task
;
import
org.gradle.api.artifacts.Configuration
;
import
org.gradle.api.artifacts.Dependency
;
import
org.gradle.api.artifacts.Dependency
;
import
org.gradle.api.logging.Logger
;
import
org.gradle.api.logging.Logger
;
import
org.gradle.api.plugins.BasePlugin
;
import
org.gradle.api.plugins.BasePlugin
;
import
org.gradle.api.plugins.JavaPlugin
;
import
org.gradle.api.tasks.TaskDependency
;
import
org.gradle.api.tasks.bundling.Jar
;
import
org.gradle.api.tasks.bundling.Jar
;
import
org.springframework.boot.gradle.PluginFeatures
;
import
org.springframework.boot.gradle.PluginFeatures
;
import
org.springframework.boot.gradle.SpringBootPluginExtension
;
import
org.springframework.boot.gradle.SpringBootPluginExtension
;
...
@@ -37,6 +40,7 @@ import org.springframework.util.StringUtils;
...
@@ -37,6 +40,7 @@ import org.springframework.util.StringUtils;
*
*
* @author Phillip Webb
* @author Phillip Webb
* @author Dave Syer
* @author Dave Syer
* @author Andy Wilkinson
*/
*/
public
class
RepackagePluginFeatures
implements
PluginFeatures
{
public
class
RepackagePluginFeatures
implements
PluginFeatures
{
...
@@ -55,9 +59,14 @@ public class RepackagePluginFeatures implements PluginFeatures {
...
@@ -55,9 +59,14 @@ public class RepackagePluginFeatures implements PluginFeatures {
+
"archives so that they can be executed from the command "
+
"archives so that they can be executed from the command "
+
"line using 'java -jar'"
);
+
"line using 'java -jar'"
);
task
.
setGroup
(
BasePlugin
.
BUILD_GROUP
);
task
.
setGroup
(
BasePlugin
.
BUILD_GROUP
);
task
.
dependsOn
(
project
.
getConfigurations
()
Configuration
runtimeConfiguration
=
project
.
getConfigurations
().
getByName
(
.
getByName
(
Dependency
.
ARCHIVES_CONFIGURATION
).
getAllArtifacts
()
JavaPlugin
.
RUNTIME_CONFIGURATION_NAME
);
.
getBuildDependencies
());
TaskDependency
runtimeProjectDependencyJarTasks
=
runtimeConfiguration
.
getTaskDependencyFromProjectDependency
(
true
,
JavaPlugin
.
JAR_TASK_NAME
);
task
.
dependsOn
(
project
.
getConfigurations
().
getByName
(
Dependency
.
ARCHIVES_CONFIGURATION
)
.
getAllArtifacts
().
getBuildDependencies
(),
runtimeProjectDependencyJarTasks
);
registerOutput
(
project
,
task
);
registerOutput
(
project
,
task
);
ensureTaskRunsOnAssembly
(
project
,
task
);
ensureTaskRunsOnAssembly
(
project
,
task
);
}
}
...
@@ -121,7 +130,7 @@ public class RepackagePluginFeatures implements PluginFeatures {
...
@@ -121,7 +130,7 @@ public class RepackagePluginFeatures implements PluginFeatures {
private
void
setupInputOutputs
(
Jar
jarTask
,
String
classifier
)
{
private
void
setupInputOutputs
(
Jar
jarTask
,
String
classifier
)
{
Logger
logger
=
this
.
project
.
getLogger
();
Logger
logger
=
this
.
project
.
getLogger
();
logger
.
debug
(
"Using classifier: "
+
classifier
+
" for task "
logger
.
debug
(
"Using classifier: "
+
classifier
+
" for task "
+
task
.
getName
());
+
t
his
.
t
ask
.
getName
());
File
inputFile
=
jarTask
.
getArchivePath
();
File
inputFile
=
jarTask
.
getArchivePath
();
String
outputName
=
inputFile
.
getName
();
String
outputName
=
inputFile
.
getName
();
outputName
=
StringUtils
.
stripFilenameExtension
(
outputName
)
+
"-"
outputName
=
StringUtils
.
stripFilenameExtension
(
outputName
)
+
"-"
...
...
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