Skip to content

Commit 4b88114

Browse files
authored
Merge pull request #123 from hazendaz/master
Support parent 35
2 parents 2399e45 + c895914 commit 4b88114

16 files changed

+216
-68
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
strategy:
2525
matrix:
2626
os: [ubuntu-latest, macOS-latest, windows-latest]
27-
java: [8, 11, 17, 18, 19-ea]
27+
java: [11, 17, 18, 19-ea]
2828
distribution: ['zulu']
2929
fail-fast: false
3030
max-parallel: 4

.github/workflows/coveralls.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Set up JDK
2828
uses: actions/setup-java@v3
2929
with:
30-
java-version: 8
30+
java-version: 11
3131
distribution: zulu
3232
- name: Report Coverage to Coveralls for Pull Requests
3333
if: github.event_name == 'pull_request'

.github/workflows/sonar.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: Set up JDK
3434
uses: actions/setup-java@v3
3535
with:
36-
java-version: 11
36+
java-version: 17
3737
distribution: zulu
3838
- name: Analyze with SonarCloud
3939
run: ./mvnw verify jacoco:report sonar:sonar -B -Dsonar.projectKey=mybatis_freemarker-scripting -Dsonar.organization=mybatis -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN -Dlicense.skip=true

.github/workflows/sonatype.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- name: Set up JDK
3131
uses: actions/setup-java@v3
3232
with:
33-
java-version: 11
33+
java-version: 17
3434
distribution: zulu
3535
- name: Deploy to Sonatype
3636
run: ./mvnw deploy -DskipTests -B --settings ./.mvn/settings.xml -Dlicense.skip=true

.mvn/extensions.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright 2015-2021 the original author or authors.
4+
Copyright 2015-2022 the original author or authors.
55
66
Licensed under the Apache License, Version 2.0 (the "License");
77
you may not use this file except in compliance with the License.

.mvn/maven.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-Daether.checksums.algorithms=SHA-512,SHA-256,SHA-1,MD5

.mvn/settings.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright 2015-2020 the original author or authors.
4+
Copyright 2015-2022 the original author or authors.
55
66
Licensed under the Apache License, Version 2.0 (the "License");
77
you may not use this file except in compliance with the License.
@@ -16,8 +16,8 @@
1616
limitations under the License.
1717
1818
-->
19-
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20-
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
19+
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd">
2121
<servers>
2222
<server>
2323
<id>ossrh</id>
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import java.io.IOException;
21+
import java.io.InputStream;
22+
import java.net.Authenticator;
23+
import java.net.PasswordAuthentication;
24+
import java.net.URL;
25+
import java.nio.file.Files;
26+
import java.nio.file.LinkOption;
27+
import java.nio.file.Path;
28+
import java.nio.file.Paths;
29+
import java.nio.file.StandardCopyOption;
30+
import java.nio.file.StandardOpenOption;
31+
import java.util.Properties;
32+
33+
public final class MavenWrapperDownloader
34+
{
35+
private static final String WRAPPER_VERSION = "3.1.1";
36+
37+
private static final boolean VERBOSE = Boolean.parseBoolean( System.getenv( "MVNW_VERBOSE" ) );
38+
39+
/**
40+
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
41+
*/
42+
private static final String DEFAULT_DOWNLOAD_URL =
43+
"https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/" + WRAPPER_VERSION
44+
+ "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
45+
46+
/**
47+
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to use instead of the
48+
* default one.
49+
*/
50+
private static final String MAVEN_WRAPPER_PROPERTIES_PATH = ".mvn/wrapper/maven-wrapper.properties";
51+
52+
/**
53+
* Path where the maven-wrapper.jar will be saved to.
54+
*/
55+
private static final String MAVEN_WRAPPER_JAR_PATH = ".mvn/wrapper/maven-wrapper.jar";
56+
57+
/**
58+
* Name of the property which should be used to override the default download url for the wrapper.
59+
*/
60+
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
61+
62+
public static void main( String[] args )
63+
{
64+
if ( args.length == 0 )
65+
{
66+
System.err.println( " - ERROR projectBasedir parameter missing" );
67+
System.exit( 1 );
68+
}
69+
70+
log( " - Downloader started" );
71+
final String dir = args[0].replace( "..", "" ); // Sanitize path
72+
final Path projectBasedir = Paths.get( dir ).toAbsolutePath().normalize();
73+
if ( !Files.isDirectory( projectBasedir, LinkOption.NOFOLLOW_LINKS ) )
74+
{
75+
System.err.println( " - ERROR projectBasedir not exists: " + projectBasedir );
76+
System.exit( 1 );
77+
}
78+
79+
log( " - Using base directory: " + projectBasedir );
80+
81+
// If the maven-wrapper.properties exists, read it and check if it contains a custom
82+
// wrapperUrl parameter.
83+
Path mavenWrapperPropertyFile = projectBasedir.resolve( MAVEN_WRAPPER_PROPERTIES_PATH );
84+
String url = readWrapperUrl( mavenWrapperPropertyFile );
85+
86+
try
87+
{
88+
Path outputFile = projectBasedir.resolve( MAVEN_WRAPPER_JAR_PATH );
89+
createDirectories( outputFile.getParent() );
90+
downloadFileFromURL( url, outputFile );
91+
log( "Done" );
92+
System.exit( 0 );
93+
}
94+
catch ( IOException e )
95+
{
96+
System.err.println( "- Error downloading" );
97+
e.printStackTrace();
98+
System.exit( 1 );
99+
}
100+
}
101+
102+
private static void downloadFileFromURL( String urlString, Path destination ) throws IOException
103+
{
104+
log( " - Downloading to: " + destination );
105+
if ( System.getenv( "MVNW_USERNAME" ) != null && System.getenv( "MVNW_PASSWORD" ) != null )
106+
{
107+
final String username = System.getenv( "MVNW_USERNAME" );
108+
final char[] password = System.getenv( "MVNW_PASSWORD" ).toCharArray();
109+
Authenticator.setDefault( new Authenticator()
110+
{
111+
@Override
112+
protected PasswordAuthentication getPasswordAuthentication()
113+
{
114+
return new PasswordAuthentication( username, password );
115+
}
116+
} );
117+
}
118+
URL website = new URL( urlString );
119+
try ( InputStream inStream = website.openStream() ) {
120+
Files.copy( inStream, destination, StandardCopyOption.REPLACE_EXISTING );
121+
}
122+
log( " - Downloader complete" );
123+
}
124+
125+
private static void createDirectories(Path outputPath) throws IOException
126+
{
127+
if ( !Files.isDirectory( outputPath, LinkOption.NOFOLLOW_LINKS ) ) {
128+
Path createDirectories = Files.createDirectories( outputPath );
129+
log( " - Directories created: " + createDirectories );
130+
}
131+
}
132+
133+
private static String readWrapperUrl( Path mavenWrapperPropertyFile )
134+
{
135+
String url = DEFAULT_DOWNLOAD_URL;
136+
if ( Files.exists( mavenWrapperPropertyFile, LinkOption.NOFOLLOW_LINKS ) )
137+
{
138+
log( " - Reading property file: " + mavenWrapperPropertyFile );
139+
try ( InputStream in = Files.newInputStream( mavenWrapperPropertyFile, StandardOpenOption.READ ) )
140+
{
141+
Properties mavenWrapperProperties = new Properties();
142+
mavenWrapperProperties.load( in );
143+
url = mavenWrapperProperties.getProperty( PROPERTY_NAME_WRAPPER_URL, DEFAULT_DOWNLOAD_URL );
144+
}
145+
catch ( IOException e )
146+
{
147+
System.err.println( " - ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'" );
148+
}
149+
}
150+
log( " - Downloading from: " + url );
151+
return url;
152+
}
153+
154+
private static void log( String msg )
155+
{
156+
if ( VERBOSE )
157+
{
158+
System.out.println( msg );
159+
}
160+
}
161+
162+
}

.mvn/wrapper/maven-wrapper.properties

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
# to you under the Apache License, Version 2.0 (the
66
# "License"); you may not use this file except in compliance
77
# with the License. You may obtain a copy of the License at
8-
#
9-
# http://www.apache.org/licenses/LICENSE-2.0
10-
#
8+
#
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
1111
# Unless required by applicable law or agreed to in writing,
1212
# software distributed under the License is distributed on an
1313
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1414
# KIND, either express or implied. See the License for the
1515
# specific language governing permissions and limitations
1616
# under the License.
17-
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip
18-
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
17+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
18+
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
File renamed without changes.

0 commit comments

Comments
 (0)