Skip to content

Commit

Permalink
fixed Maven version detection using invoker.maven.version property
Browse files Browse the repository at this point in the history
fixes issue introduced in #154 trying to fix #140
  • Loading branch information
hboutemy committed Feb 28, 2021
1 parent 508bc91 commit 4a38133
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 35 deletions.
3 changes: 3 additions & 0 deletions src/it/projects/no-overwrite-3.6.2-before/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# .flattened-pom.xml contains xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
# xsd url changed to HTTPS in Maven 3.6.3 in https://issues.apache.org/jira/browse/MNG-6778
invoker.maven.version = !3.6.3+
21 changes: 4 additions & 17 deletions src/it/projects/no-overwrite-3.6.2-before/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
String os = System.getProperty("os.name");
String[] mavenWords = os.contains("Windows") ? "mvnw.cmd -v".execute().text.split() : "./mvnw -v".execute().text.split()
String mavenVersion = mavenWords[1] == "Maven" ? mavenWords[2] : mavenWords[3]
String[] mavenVersionArray = mavenVersion.split("\\.")
int[] versionArray = new int[3]
for (int i = 0; i < 3; i++)
versionArray[i] = Integer.valueOf(mavenVersionArray[i])
boolean isValid = versionArray[0] < 3\
|| versionArray[0] == 3 && versionArray[1] < 6\
|| versionArray[0] == 3 && versionArray[1] == 6 && versionArray[2] < 3
if (isValid) {
File flattendPom = new File( basedir, '.flattened-pom.xml' )
assert flattendPom.exists()
long now = System.currentTimeMillis()
assert now - flattendPom.lastModified() > 20*1000
}


File flattendPom = new File( basedir, '.flattened-pom.xml' )
assert flattendPom.exists()
long now = System.currentTimeMillis()
assert now - flattendPom.lastModified() > 20*1000
3 changes: 3 additions & 0 deletions src/it/projects/no-overwrite-3.6.3-later/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# .flattened-pom.xml contains xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
# xsd url changed to HTTPS in Maven 3.6.3 in https://issues.apache.org/jira/browse/MNG-6778
invoker.maven.version = 3.6.3+
22 changes: 4 additions & 18 deletions src/it/projects/no-overwrite-3.6.3-later/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,7 @@
* under the License.
*/

String os = System.getProperty("os.name").split()[0]
String[] mavenWords = os.contains("Windows") ? "mvnw.cmd -v".execute().text.split() : "./mvnw -v".execute().text.split()
String mavenVersion = mavenWords[1] == "Maven" ? mavenWords[2] : mavenWords[3]
String[] mavenVersionArray = mavenVersion.split("\\.")
int[] versionArray = new int[3]
for (int i = 0; i < 3; i++)
versionArray[i] = Integer.valueOf(mavenVersionArray[i])
boolean isValid = versionArray[0] > 3\
|| versionArray[0] == 3 && versionArray[1] > 6\
|| versionArray[0] == 3 && versionArray[1] == 6 && versionArray[2] >= 3
if (isValid) {
File flattendPom = new File( basedir, '.flattened-pom.xml' )
assert flattendPom.exists()
long now = System.currentTimeMillis()
assert now - flattendPom.lastModified() > 20*1000
}


File flattendPom = new File( basedir, '.flattened-pom.xml' )
assert flattendPom.exists()
long now = System.currentTimeMillis()
assert now - flattendPom.lastModified() > 20*1000

0 comments on commit 4a38133

Please sign in to comment.