Browse Source
This reverts commit ad164269e9 and adds
some additional tests.
Fixes gh-24192
pull/25129/head
13 changed files with 153 additions and 36 deletions
@ -0,0 +1,41 @@
@@ -0,0 +1,41 @@
|
||||
/* |
||||
* Copyright 2012-2019 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package com.example.bootjar.classpath; |
||||
|
||||
import java.net.URL; |
||||
import java.net.URLClassLoader; |
||||
|
||||
/** |
||||
* Application used for testing classpath handling with BootJar. |
||||
* |
||||
* @author Andy Wilkinson |
||||
*/ |
||||
public class BootJarClasspathApplication { |
||||
|
||||
protected BootJarClasspathApplication() { |
||||
|
||||
} |
||||
|
||||
public static void main(String[] args) { |
||||
int i = 1; |
||||
ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); |
||||
for (URL url : ((URLClassLoader) classLoader).getURLs()) { |
||||
System.out.println(i++ + ". " + url.getFile()); |
||||
} |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
plugins { |
||||
id 'java' |
||||
id 'org.springframework.boot' version '{version}' |
||||
} |
||||
|
||||
repositories { |
||||
mavenCentral() |
||||
maven { url "file:repository" } |
||||
} |
||||
|
||||
dependencies { |
||||
implementation("com.example:library:1.0-SNAPSHOT") |
||||
implementation("org.apache.commons:commons-lang3:3.9") |
||||
} |
||||
|
||||
task explode(type: Sync) { |
||||
dependsOn(bootJar) |
||||
destinationDir = file("$buildDir/exploded") |
||||
from zipTree(files(bootJar).singleFile) |
||||
} |
||||
|
||||
task launch(type: JavaExec) { |
||||
classpath = files(explode) |
||||
main = 'org.springframework.boot.loader.JarLauncher' |
||||
} |
||||
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
|
||||
plugins { |
||||
id 'java' |
||||
id 'org.springframework.boot' version '{version}' |
||||
} |
||||
|
||||
task launch(type: JavaExec) { |
||||
classpath = files(bootJar) |
||||
} |
||||
|
||||
repositories { |
||||
mavenCentral() |
||||
maven { url "file:repository" } |
||||
} |
||||
|
||||
dependencies { |
||||
implementation("com.example:library:1.0-SNAPSHOT") |
||||
implementation("org.apache.commons:commons-lang3:3.9") |
||||
} |
||||
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
||||
- "a.jar" |
||||
- "b.jar" |
||||
- "c.jar" |
||||
- "d.jar" |
||||
- "e.jar" |
||||
- "BOOT-INF/layers/one/lib/a.jar" |
||||
- "BOOT-INF/layers/one/lib/b.jar" |
||||
- "BOOT-INF/layers/one/lib/c.jar" |
||||
- "BOOT-INF/layers/two/lib/d.jar" |
||||
- "BOOT-INF/layers/two/lib/e.jar" |
||||
|
||||
Loading…
Reference in new issue