File tree Expand file tree Collapse file tree 4 files changed +63
-2
lines changed
modules/maven/default/artifacts/opt/jboss/container/maven/default Expand file tree Collapse file tree 4 files changed +63
-2
lines changed Original file line number Diff line number Diff line change @@ -74,8 +74,11 @@ function maven_build() {
74
74
log_info " Using MAVEN_OPTS ${MAVEN_OPTS} "
75
75
log_info " Using $( mvn $MAVEN_ARGS --version) "
76
76
log_info " Running 'mvn $MAVEN_ARGS $goals '"
77
- # Execute the actual build
78
- mvn $MAVEN_ARGS $goals
77
+
78
+ # Execute the actual build (ensuring MAVEN_ARGS is unset, OPENJDK-1549)
79
+ REAL_MAVEN_ARGS=" $MAVEN_ARGS "
80
+ unset MAVEN_ARGS
81
+ mvn $REAL_MAVEN_ARGS $goals
79
82
80
83
popd & > /dev/null
81
84
Original file line number Diff line number Diff line change
1
+ # Test for OPENJDK-1549
2
+
3
+ < https://issues.redhat.com/browse/OPENJDK-1549 >
4
+
5
+ This is a minimal Maven project for which the ` validate ` target will fail
6
+ if the environment variable ` MAVEN_ARGS ` is defined.
7
+
8
+ This is achieved using the Enforcer plugin. We could not use the
9
+ ` requireEnvironmentVariable ` built-in rule as it can only fail if a variable
10
+ is undefined, rather than if it is. Instead we use ` evaluateBeanshell ` and
11
+ a very short Beanshell expression.
12
+
13
+ Maven expands strings of the form ` ${env.foo} ` within the POM only if the
14
+ variable is defined. That is, when ` MAVEN_ARGS ` is not defined in the
15
+ environment, the string ` ${env.MAVEN_ARGS} ` is passed through unaltered.
16
+ If the variable is defined (including defined but empty), Maven will expand
17
+ it. Some string concatenation trickery is needed to match against the
18
+ un-expanded form.
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <project >
3
+ <modelVersion >4.0.0</modelVersion >
4
+ <groupId >org.acme</groupId >
5
+ <artifactId >getting-started</artifactId >
6
+ <version >1.0.0-SNAPSHOT</version >
7
+ <build >
8
+ <plugins >
9
+ <plugin >
10
+ <groupId >org.apache.maven.plugins</groupId >
11
+ <artifactId >maven-enforcer-plugin</artifactId >
12
+ <version >3.3.0</version >
13
+ <executions >
14
+
15
+ <!-- ensure the environment variable MAVEN_ARGS is unset -->
16
+ <execution >
17
+ <id >enforce-beanshell</id >
18
+ <goals >
19
+ <goal >enforce</goal >
20
+ </goals >
21
+ <configuration >
22
+ <rules >
23
+ <evaluateBeanshell >
24
+ <condition >"${env.MAVEN_ARGS} ".equals("${env."+"MAVEN_ARGS} ")</condition >
25
+ </evaluateBeanshell >
26
+ </rules >
27
+ <fail >true</fail >
28
+ </configuration >
29
+ </execution >
30
+
31
+ </executions >
32
+ </plugin >
33
+ </plugins >
34
+ </build >
35
+ </project >
Original file line number Diff line number Diff line change @@ -166,3 +166,8 @@ Feature: Openshift OpenJDK S2I tests
166
166
| ns | http ://maven .apache .org /SETTINGS /1 .0 .0 |
167
167
Then XML file /tmp/artifacts/configuration/settings.xml should have 1 elements on XPath //ns:server[ns:id='myrepo' ]
168
168
Then XML file /tmp/artifacts/configuration/settings.xml should have 1 elements on XPath //ns:profile[ns:id='myrepo-profile' ]/ns:repositories/ns:repository[ns:url='http://repo.example.com:8080/maven2/' ]
169
+
170
+ Scenario : Ensure the environment is cleaned when executing mvn (OPENJDK-1549)
171
+ Given s2i build https://github.com/jmtd/openjdk from tests/OPENJDK-1549 with env using OPENJDK-1549-maven-args-take-2
172
+ | variable | value |
173
+ | MAVEN_ARGS | validate |
You can’t perform that action at this time.
0 commit comments