Skip to content

Commit 05db52b

Browse files
committed
Extract spring-boot-testjars-maven jar
Rather than use feature variants, use a new jar for the maven support. This makes it simple to ensure that the pom and jar are published properly. Additionally, there currently isn't the need to restrict the permutations of the feature (e.g. only one way of doing logging). Closes gh-39
1 parent 80f46f3 commit 05db52b

File tree

17 files changed

+118
-38
lines changed

17 files changed

+118
-38
lines changed

README.adoc

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,25 +87,20 @@ static CommonsExecWebServerFactoryBean authorizationServer() {
8787

8888
You can also use the `MavenClasspathEntry` constructor directly or additional helper methods to add dependencies other than Spring Boot starters to the classpath.
8989

90-
To use this feature, use the https://docs.gradle.org/current/userguide/feature_variants.html[feature variant] named `maven` by adding it to your Gradle or Maven build.
90+
To use this feature, add the following to your build:
9191

9292
.build.gradle
9393
[source,groovy,subs=attributes+]
9494
----
95-
testImplementation ('org.springframework.experimental.boot:spring-boot-testjars:{TESTJARS_VERSION}') {
96-
capabilities {
97-
requireCapability("org.springframework.experimental.boot:spring-boot-testjars-maven")
98-
}
99-
}
95+
testImplementation 'org.springframework.experimental.boot:spring-boot-testjars-maven:{TESTJARS_VERSION}'
10096
----
10197

10298
.pom.xml
10399
[source,xml,subs=attributes+]
104100
----
105101
<dependency>
106102
<groupId>org.springframework.experimental.boot</groupId>
107-
<artifactId>spring-boot-testjars</artifactId>
108-
<classifier>maven</classifier>
103+
<artifactId>spring-boot-testjars-maven</artifactId>
109104
<version>{TESTJARS_VERSION}</version>
110105
</dependency>
111106
----

samples/oauth2-login-custom-config/build.gradle

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,8 @@ dependencies {
1818
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
1919
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
2020
implementation 'org.springframework.boot:spring-boot-starter-web'
21-
testImplementation (project(':spring-boot-testjars'))
22-
testImplementation (project(':spring-boot-testjars')) {
23-
capabilities {
24-
requireCapability("org.springframework.experimental.boot:spring-boot-testjars-maven")
25-
}
26-
}
21+
testImplementation project(':spring-boot-testjars')
22+
testImplementation project(':spring-boot-testjars-maven')
2723
testImplementation 'org.springframework.boot:spring-boot-starter-test'
2824
testImplementation 'org.springframework.boot:spring-boot-starter-oauth2-authorization-server'
2925
}

samples/oauth2-login/build.gradle

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,8 @@ dependencies {
1818
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
1919
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
2020
implementation 'org.springframework.boot:spring-boot-starter-web'
21-
testImplementation (project(':spring-boot-testjars'))
22-
testImplementation (project(':spring-boot-testjars')) {
23-
capabilities {
24-
requireCapability("org.springframework.experimental.boot:spring-boot-testjars-maven")
25-
}
26-
}
21+
testImplementation project(':spring-boot-testjars')
22+
testImplementation project(':spring-boot-testjars-maven')
2723
testImplementation 'org.springframework.boot:spring-boot-starter-test'
2824
}
2925

samples/oauth2-login/src/test/java/example/oauth2/login/TestOauth2LoginMain.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import org.springframework.boot.SpringApplication;
2020
import org.springframework.boot.test.context.TestConfiguration;
2121
import org.springframework.context.annotation.Bean;
22-
import org.springframework.experimental.boot.server.exec.CommonsExecWebServer;
2322
import org.springframework.experimental.boot.server.exec.CommonsExecWebServerFactoryBean;
2423
import org.springframework.experimental.boot.test.context.EnableDynamicProperty;
2524
import org.springframework.experimental.boot.test.context.OAuth2ClientProviderIssuerUri;

settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ pluginManagement {
1111
rootProject.name = 'spring-boot-testjars-build'
1212

1313
include ':spring-boot-testjars'
14+
include ':spring-boot-testjars-maven'
1415
include ':samples:oauth2-login'
1516
include ':samples:oauth2-login-custom-config'
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
plugins {
2+
id'java-library'
3+
id'checkstyle'
4+
id'io.spring.javaformat' version'0.0.27'
5+
id "io.spring.security.maven" version "1.0.1"
6+
id 'publish-conventions'
7+
}
8+
9+
group = 'org.springframework.experimental.boot'
10+
11+
ext {
12+
mavenResolverVersion = '1.9.18'
13+
mavenVersion = '3.9.4'
14+
}
15+
16+
java {
17+
sourceCompatibility = '17'
18+
}
19+
20+
repositories {
21+
mavenCentral()
22+
}
23+
24+
checkstyle {
25+
toolVersion = "9.3"
26+
}
27+
28+
dependencies {
29+
checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:0.0.40")
30+
api project(':spring-boot-testjars')
31+
api platform('org.springframework.boot:spring-boot-dependencies:3.4.0')
32+
api 'org.springframework.boot:spring-boot-starter'
33+
api "org.apache.maven:maven-resolver-provider:${mavenVersion}"
34+
api "org.apache.maven.resolver:maven-resolver-api:${mavenResolverVersion}"
35+
api "org.apache.maven.resolver:maven-resolver-spi:${mavenResolverVersion}"
36+
api "org.apache.maven.resolver:maven-resolver-util:${mavenResolverVersion}"
37+
api "org.apache.maven.resolver:maven-resolver-impl:${mavenResolverVersion}"
38+
api "org.apache.maven.resolver:maven-resolver-connector-basic:${mavenResolverVersion}"
39+
api "org.apache.maven.resolver:maven-resolver-transport-file:${mavenResolverVersion}"
40+
api "org.apache.maven.resolver:maven-resolver-transport-http:${mavenResolverVersion}"
41+
api "org.apache.maven.resolver:maven-resolver-supplier:${mavenResolverVersion}"
42+
testImplementation 'org.springframework.boot:spring-boot-starter-test'
43+
testImplementation 'org.springframework:spring-web'
44+
}
45+
46+
tasks.named('test') {
47+
useJUnitPlatform()
48+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright 2012-2023 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/**
18+
* Provides {@link org.springframework.boot.web.server.WebServer} that is started via a
19+
* command.
20+
*/
21+
package org.springframework.experimental.boot.server.exec;

0 commit comments

Comments
 (0)