File tree Expand file tree Collapse file tree 3 files changed +34
-3
lines changed
buildSrc/src/main/groovy/io/spring/gradle/convention Expand file tree Collapse file tree 3 files changed +34
-3
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ public abstract class AbstractSpringJavaPlugin implements Plugin<Project> {
35
35
36
36
@Override
37
37
public final void apply (Project project ) {
38
+ initialPlugins(project);
38
39
PluginManager pluginManager = project. getPluginManager();
39
40
pluginManager. apply(JavaPlugin . class);
40
41
pluginManager. apply(ManagementConfigurationPlugin . class)
@@ -69,5 +70,7 @@ public abstract class AbstractSpringJavaPlugin implements Plugin<Project> {
69
70
additionalPlugins(project);
70
71
}
71
72
73
+ protected void initialPlugins (Project project ) {}
74
+
72
75
protected abstract void additionalPlugins (Project project );
73
76
}
Original file line number Diff line number Diff line change @@ -30,4 +30,19 @@ public class SpringSamplePlugin extends AbstractSpringJavaPlugin {
30
30
project. sonarqube. skipProject = true
31
31
}
32
32
}
33
+
34
+ @Override
35
+ protected void initialPlugins (Project project ) {
36
+ if (project. hasProperty(' springBootVersion' )) {
37
+ String springBootVersion = project. springBootVersion
38
+
39
+ if (Utils . isSnapshot(springBootVersion)) {
40
+ project. ext. forceMavenRepositories = ' snapshot'
41
+ }
42
+ else if (Utils . isMilestone(springBootVersion)) {
43
+ project. ext. forceMavenRepositories = ' milestone'
44
+ }
45
+ }
46
+
47
+ }
33
48
}
Original file line number Diff line number Diff line change @@ -14,16 +14,29 @@ public class Utils {
14
14
15
15
static boolean isSnapshot (Project project ) {
16
16
String projectVersion = projectVersion(project)
17
- return projectVersion . matches( ' ^.*([.-]BUILD)?-SNAPSHOT$ ' )
17
+ return isSnapshot(projectVersion )
18
18
}
19
19
20
20
static boolean isMilestone (Project project ) {
21
21
String projectVersion = projectVersion(project)
22
- return projectVersion . matches( ' ^.*[.-]M \\ d+$ ' ) || projectVersion. matches( ' ^.*[.-]RC \\ d+$ ' )
22
+ return isMilestone( projectVersion)
23
23
}
24
24
25
25
static boolean isRelease (Project project ) {
26
- return ! (isSnapshot(project) || isMilestone(project))
26
+ String projectVersion = projectVersion(project)
27
+ return isRelease(projectVersion)
28
+ }
29
+
30
+ static boolean isSnapshot (String projectVersion ) {
31
+ return projectVersion. matches(' ^.*([.-]BUILD)?-SNAPSHOT$' )
32
+ }
33
+
34
+ static boolean isMilestone (String projectVersion ) {
35
+ return projectVersion. matches(' ^.*[.-]M\\ d+$' ) || projectVersion. matches(' ^.*[.-]RC\\ d+$' )
36
+ }
37
+
38
+ static boolean isRelease (String projectVersion ) {
39
+ return ! (isSnapshot(projectVersion) || isMilestone(projectVersion))
27
40
}
28
41
29
42
private static String projectVersion (Project project ) {
You can’t perform that action at this time.
0 commit comments