10000 HV-1879 Backport HV-1806 Make sure Karaf-based tests use the same loc… · hibernate/hibernate-validator@ea83235 · GitHub
[go: up one dir, main page]

Skip to content

Commit ea83235

Browse files
yrodieregsmet
authored andcommitted
HV-1879 Backport HV-1806 Make sure Karaf-based tests use the same local Maven repository as the Maven build
Otherwise, when the Maven local repository of the Maven build isn't the default one, Pax-Exam ends up not finding OSGi artifacts we just built.
1 parent c186334 commit ea83235

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

osgi/integrationtest/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@
169169
<configuration>
170170
<reuseForks>false</reuseForks>
171171
<systemPropertyVariables>
172+
<maven.settings.localRepository>${settings.localRepository}</maven.settings.localRepository>
172173
<maven.mavencentral.repo.url>${mavencentral.repo.url}</maven.mavencentral.repo.url>
173174
</systemPropertyVariables>
174175
</configuration>

osgi/integrationtest/src/test/java/org/hibernate/validator/osgi/integrationtest/KarafFeaturesAreInstallableTest.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public Option[] config() {
6767
.type( "xml" )
6868
.versionAsInProject();
6969

70+
String mavenLocalRepository = System.getProperty( "maven.settings.localRepository" );
7071
String mavenCentralRepository = System.getProperty( "maven.mavencentral.repo.url" );
7172

7273
return options(
@@ -94,6 +95,26 @@ public Option[] config() {
9495
"featuresBoot",
9596
"system"
9697
),
98+
/*
99+
* Use the same local Maven repository as the build job.
100+
* This allows to retrieve the just-installed artifacts in case
101+
* the local repo was overridden from the command line.
102+
*
103+
* See https://ops4j1.jira.com/wiki/spaces/paxurl/pages/3833866/Mvn+Protocol for more information
104+
* on the configuration below.
105+
*/
106+
editConfigurationFilePut(
107+
"etc/org.ops4j.pax.url.mvn.cfg",
108+
"org.ops4j.pax.url.mvn.defaultRepositories",
109+
"file://" + mavenLocalRepository
110+
+ "@snapshots"
111+
+ "@id=local-repo-from-maven-settings"
112+
),
113+
editConfigurationFilePut(
114+
"etc/org.ops4j.pax.url.mvn.cfg",
115+
"org.ops4j.pax.url.mvn.localRepository",
116+
mavenLocalRepository
117+
),
97118
editConfigurationFilePut( // Erase the defaults: Maven Central uses HTTP by default...
98119
"etc/org.ops4j.pax.url.mvn.cfg",
99120
"org.ops4j.pax.url.mvn.repositories",

osgi/integrationtest/src/test/java/org/hibernate/validator/osgi/integrationtest/OsgiIntegrationTest.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ public Option[] config() {
9090
.type( "xml" )
9191
.versionAsInProject();
9292

93+
String mavenLocalRepository = System.getProperty( "maven.settings.localRepository" );
9394
String mavenCentralRepository = System.getProperty( "maven.mavencentral.repo.url" );
9495

9596
return options(
@@ -117,6 +118,26 @@ public Option[] config() {
117118
"featuresBoot",
118119
"system"
119120
),
121+
/*
122+
* Use the same local Maven repository as the build job.
123+
* This allows to retrieve the just-installed artifacts in case
124+
* the local repo was overridden from the command line.
125+
*
126+
* See https://ops4j1.jira.com/wiki/spaces/paxurl/pages/3833866/Mvn+Protocol for more information
127+
* on the configuration below.
128+
*/
129+
editConfigurationFilePut(
130+
"etc/org.ops4j.pax.url.mvn.cfg",
131+
"org.ops4j.pax.url.mvn.defaultRepositories",
132+
"file://" + mavenLocalRepository
133+
+ "@snapshots"
134+
+ "@id=local-repo-from-maven-settings"
135+
),
136+
editConfigurationFilePut(
137+
"etc/org.ops4j.pax.url.mvn.cfg",
138+
"org.ops4j.pax.url.mvn.localRepository",
139+
mavenLocalRepository
140+
),
120141
editConfigurationFilePut( // Erase the defaults: Maven Central uses HTTP by default...
121142
"etc/org.ops4j.pax.url.mvn.cfg",
122143
"org.ops4j.pax.url.mvn.repositories",

0 commit comments

Comments
 (0)
0