Skip to content

Commit 3f16542

Browse files
committed
XCOMMONS-3043: os.* system properties should be transmitted to Maven
1 parent bbf9959 commit 3f16542

File tree

3 files changed

+62
-1
lines changed

3 files changed

+62
-1
lines changed

xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-repositories/xwiki-commons-extension-repository-maven/src/main/java/org/xwiki/extension/repository/aether/internal/XWikiRepositorySystemSession.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public class XWikiRepositorySystemSession extends AbstractForwardingRepositorySy
6262
{
6363
static final JreProxySelector JREPROXYSELECTOR = new JreProxySelector();
6464

65-
private static final Set<String> SYSTEM_PROPERTIES = Set.of("java.version");
65+
private static final Set<String> SYSTEM_PROPERTIES = Set.of("java.version", "os.name", "os.arch", "os.version");
6666

6767
@Inject
6868
private MavenArtifactHandlerManager standardHandlers;

xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-repositories/xwiki-commons-extension-repository-maven/src/test/java/org/xwiki/extension/repository/aether/internal/AetherDefaultRepositoryManagerTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,15 @@ public void testResolveDependencyFromUnknownRepository() throws ResolveException
615615
assertEquals(dependency.getId(), dependencyExtension.getId().getId());
616616
}
617617

618+
@Test
619+
public void testResolveWithProfileActivation() throws ResolveException
620+
{
621+
Extension extension = this.repositoryManager.resolve(new ExtensionId("groupid:profileactivation", "version"));
622+
623+
assertEquals("javapropertyvalue", extension.getProperty("xwiki.extension.javaproperty"));
624+
assertEquals("ospropertyvalue", extension.getProperty("xwiki.extension.osproperty"));
625+
}
626+
618627
// Failures
619628

620629
@Test(expected = ExtensionNotFoundException.class)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!--
4+
* See the NOTICE file distributed with this work for additional
5+
* information regarding copyright ownership.
6+
*
7+
* This is free software; you can redistribute it and/or modify it
8+
* under the terms of the GNU Lesser General Public License as
9+
* published by the Free Software Foundation; either version 2.1 of
10+
* the License, or (at your option) any later version.
11+
*
12+
* This software is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
* Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public
18+
* License along with this software; if not, write to the Free
19+
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20+
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21+
-->
22+
23+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
24+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
25+
<modelVersion>4.0.0</modelVersion>
26+
<groupId>groupid</groupId>
27+
<artifactId>profileactivation</artifactId>
28+
<version>version</version>
29+
<packaging>type</packaging>
30+
<profiles>
31+
<profile>
32+
<id>javaversion</id>
33+
<activation>
34+
<jdk>[1.8,)</jdk>
35+
</activation>
36+
<properties>
37+
<xwiki.extension.javaproperty>javapropertyvalue</xwiki.extension.javaproperty>
38+
</properties>
39+
</profile>
40+
<profile>
41+
<id>osfamilly</id>
42+
<activation>
43+
<os>
44+
<family>!noos</family>
45+
</os>
46+
</activation>
47+
<properties>
48+
<xwiki.extension.osproperty>ospropertyvalue</xwiki.extension.osproperty>
49+
</properties>
50+
</profile>
51+
</profiles>
52+
</project>

0 commit comments

Comments
 (0)