Skip to content

Commit 796307a

Browse files
chaliwilkinsona
authored andcommitted
Mark bootArchives configuration as unresolvable
See gh-22943
1 parent cf8776b commit 796307a

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SpringBootPlugin.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ private void createExtension(Project project) {
111111
private Configuration createBootArchivesConfiguration(Project project) {
112112
Configuration bootArchives = project.getConfigurations().create(BOOT_ARCHIVES_CONFIGURATION_NAME);
113113
bootArchives.setDescription("Configuration for Spring Boot archive artifacts.");
114+
bootArchives.setCanBeResolved(false);
114115
return bootArchives;
115116
}
116117

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Copyright 2012-2020 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+
package org.springframework.boot.gradle.plugin;
18+
19+
import java.io.File;
20+
import java.io.IOException;
21+
22+
import org.gradle.api.Project;
23+
import org.gradle.api.artifacts.Configuration;
24+
import org.gradle.testfixtures.ProjectBuilder;
25+
import org.junit.jupiter.api.BeforeEach;
26+
import org.junit.jupiter.api.Test;
27+
import org.junit.jupiter.api.io.TempDir;
28+
29+
import static org.assertj.core.api.Assertions.assertThat;
30+
31+
/**
32+
* Tests for expectations about {code bootArchives} Gradle configuration about its
33+
* purpose.
34+
*
35+
* @author Martin Chalupa
36+
*/
37+
public class BootArchivesConfigurationContractTests {
38+
39+
@TempDir
40+
File temp;
41+
42+
private Project project;
43+
44+
@BeforeEach
45+
void createConvention() throws IOException {
46+
this.project = ProjectBuilder.builder().withProjectDir(this.temp).build();
47+
}
48+
49+
@Test
50+
void bootArchivesConfigurationsCannotBeResolved() {
51+
this.project.getPlugins().apply(SpringBootPlugin.class);
52+
Configuration bootArchives = this.project.getConfigurations()
53+
.getByName(SpringBootPlugin.BOOT_ARCHIVES_CONFIGURATION_NAME);
54+
assertThat(bootArchives.isCanBeResolved()).isFalse();
55+
}
56+
57+
}

0 commit comments

Comments
 (0)