File tree Expand file tree Collapse file tree 5 files changed +19
-9
lines changed
main/java/org/springframework/sbm/build/impl
test/java/org/springframework/sbm/build/impl
testcode/project-with-maven-settings Expand file tree Collapse file tree 5 files changed +19
-9
lines changed Original file line number Diff line number Diff line change @@ -75,8 +75,7 @@ public List<Xml.Document> parse(String... sources) {
75
75
@ Override
76
76
public List <Xml .Document > parse (ExecutionContext ctx , String ... sources ) {
77
77
mavenSettingsInitializer .initializeMavenSettings (ctx );
78
- parser .parse (ctx , sources );
79
- return Parser .super .parse (ctx , sources );
78
+ return parser .parse (ctx , sources );
80
79
}
81
80
82
81
/**
Original file line number Diff line number Diff line change 25
25
import java .nio .file .Path ;
26
26
27
27
import static org .assertj .core .api .Assertions .assertThat ;
28
- import static org .junit .jupiter .api .Assertions .*;
29
28
30
29
/**
31
30
* @author Fabian Krüger
@@ -72,14 +71,22 @@ void mavenParserMustAdhereToSettingsXmlTest() throws URISyntaxException {
72
71
MavenRepository localRepository = mavenExecutionContextView .getLocalRepository ();
73
72
assertThat (localRepository .isSnapshots ()).isTrue ();
74
73
75
- // assertThat(localRepository.getUri()).isEqualTo("file:" + fakedUserHome + "/.m2/repository/");
76
- assertThat (localRepository .getUri ()).isEqualTo (MavenRepository .MAVEN_LOCAL_DEFAULT .getUri ());
74
+ String tmpDir = removeTrailingSlash (System .getProperty ("java.io.tmpdir" ));
75
+ String customLocalRepository = new URI ("file://" + tmpDir ).toString ();
76
+ assertThat (removeTrailingSlash (localRepository .getUri ())).isEqualTo (customLocalRepository );
77
77
assertThat (localRepository .isSnapshots ()).isTrue ();
78
78
assertThat (localRepository .isKnownToExist ()).isTrue ();
79
79
assertThat (localRepository .getUsername ()).isNull ();
80
80
assertThat (localRepository .getPassword ()).isNull ();
81
81
}
82
82
83
+ String removeTrailingSlash (String string ) {
84
+ if (string .endsWith ("/" )){
85
+ return string .substring (0 , string .length ()-1 );
86
+ }
87
+ return string ;
88
+ }
89
+
83
90
@ AfterEach
84
91
public void reset () {
85
92
// reset
Original file line number Diff line number Diff line change @@ -49,9 +49,7 @@ void customExecutionContextGiven() {
49
49
String pom = PomBuilder .buildPom ("com.example:project:1.0" ).build ();
50
50
ExecutionContext ctx = new RewriteExecutionContext ();
51
51
sut .parse (ctx , pom );
52
- // first time when initializing the parser
53
- // second time in the parse method to guarantee ExecutionContext is enriched with MavenSettings
54
- verify (mavenSettingsInitializer , times (2 )).initializeMavenSettings (ctx );
52
+ verify (mavenSettingsInitializer ).initializeMavenSettings (ctx );
55
53
}
56
54
57
55
}
Original file line number Diff line number Diff line change
1
+ .m2 /repository /
2
+ .config
3
+ .rewrite
Original file line number Diff line number Diff line change 2
2
<settings xsi : schemaLocation =' http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd'
3
3
xmlns =' http://maven.apache.org/SETTINGS/1.0.0' xmlns : xsi =' http://www.w3.org/2001/XMLSchema-instance' >
4
4
5
+ <localRepository >${java.io.tmpdir}</localRepository >
5
6
<profiles >
6
7
<profile >
7
- <activeByDefault >true</activeByDefault >
8
+ <activation >
9
+ <activeByDefault >true</activeByDefault >
10
+ </activation >
8
11
<repositories >
9
12
<repository >
10
13
<snapshots >
You can’t perform that action at this time.
0 commit comments