Skip to content

Commit 9f4190d

Browse files
authored
Merge pull request #120 from hazendaz/master
Build updates
2 parents 0b6e15e + d7a7b02 commit 9f4190d

File tree

33 files changed

+283
-351
lines changed

33 files changed

+283
-351
lines changed

.github/workflows/ci.yaml

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,32 @@
11
name: Java CI
2-
on:
3-
push:
4-
pull_request:
2+
3+
on: [workflow_dispatch, push, pull_request]
4+
55
jobs:
6-
build:
7-
name: Verify on ${{ matrix.os }} (Java ${{ matrix.java }})
6+
test:
87
runs-on: ${{ matrix.os }}
98
strategy:
109
matrix:
11-
os:
12-
- 'ubuntu-latest'
13-
- 'windows-latest'
14-
- 'macos-latest'
15-
java:
16-
- 21
10+
os: [ubuntu-latest, macos-latest, windows-latest]
11+
java: [17]
12+
distribution: ['temurin']
1713
fail-fast: false
18-
max-parallel: 6
14+
max-parallel: 4
15+
name: Test JDK ${{ matrix.java }}, ${{ matrix.os }}
16+
1917
steps:
2018
- uses: actions/checkout@v4
21-
- name: Set up JDK
19+
- name: Set up JDK ${{ matrix.java }} ${{ matrix.distribution }}
2220
uses: actions/setup-java@v3
2321
with:
2422
java-version: ${{ matrix.java }}
25-
distribution: 'zulu'
23+
distribution: ${{ matrix.distribution }}
2624
- name: Cache local Maven repository
2725
uses: actions/cache@v3
2826
with:
2927
path: ~/.m2/repository
3028
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
3129
restore-keys: |
3230
${{ runner.os }}-maven-
33-
- name: Show a Java version
34-
run: java -version
35-
- name: Verify a mybatis-spring-native-core
36-
run: ./mvnw -U -pl .,core,extensions clean verify -D"license.skip=true"
31+
- name: Test with Maven
32+
run: ./mvnw -pl core,extensions test -B -V --no-transfer-progress -D"license.skip=true"

.github/workflows/coveralls.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: Coveralls
2+
23
on: [push, pull_request]
4+
35
jobs:
46
build:
57
if: github.repository_owner == 'mybatis'
@@ -9,7 +11,7 @@ jobs:
911
- name: Set up JDK
1012
uses: actions/setup-java@v3
1113
with:
12-
java-version: 21
14+
java-version: 17
1315
distribution: zulu
1416
- name: Cache local Maven repository
1517
uses: actions/cache@v3
@@ -20,12 +22,12 @@ jobs:
2022
${{ runner.os }}-maven-
2123
- name: Report Coverage to Coveralls for Pull Requests
2224
if: github.event_name == 'pull_request'
23-
run: ./mvnw -pl core,extensions test jacoco:report coveralls:report -q -Dlicense.skip=true -DrepoToken=$GITHUB_TOKEN -DserviceName=github -DpullRequest=$PR_NUMBER
25+
run: ./mvnw -pl core,extensions -B -V test jacoco:report coveralls:report -q -Dlicense.skip=true -DrepoToken=$GITHUB_TOKEN -DserviceName=github -DpullRequest=$PR_NUMBER --no-transfer-progress
2426
env:
2527
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2628
PR_NUMBER: ${{ github.event.number }}
2729
- name: Report Coverage to Coveralls for General Push
2830
if: github.event_name == 'push'
29-
run: ./mvnw test jacoco:report coveralls:report -q -Dlicense.skip=true -DrepoToken=$GITHUB_TOKEN -DserviceName=github
31+
run: ./mvnw -B -V test jacoco:report coveralls:report -q -Dlicense.skip=true -DrepoToken=$GITHUB_TOKEN -DserviceName=github --no-transfer-progress
3032
env:
3133
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/samples.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- 'ubuntu-latest'
1313
- 'windows-latest'
1414
java:
15-
- 21
15+
- 17
1616
sample:
1717
- 'simple'
1818
- 'xml'
@@ -51,7 +51,7 @@ jobs:
5151
java --version
5252
native-image --version
5353
- name: Build native image
54-
run: ./mvnw -pl core,extensions,samples/${{ matrix.sample }} -U -D"maven.test.skip" -Pnative -D"license.skip=true" clean package
54+
run: ./mvnw -pl core,extensions,samples/${{ matrix.sample }} -U -D"maven.test.skip" -Pnative -D"license.skip=true" clean package -B -V --no-transfer-progress
5555
- name: Run with native image
5656
run: ./samples/${{ matrix.sample }}/target/mybatis-spring-native-sample-${{ matrix.sample }}
5757
- name: Run with executable jar on AOT mode

.github/workflows/sonar.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
name: SonarCloud
2+
23
on:
34
push:
45
branches:
56
- master
7+
68
jobs:
79
build:
810
if: github.repository_owner == 'mybatis'
@@ -15,7 +17,7 @@ jobs:
1517
- name: Set up JDK
1618
uses: actions/setup-java@v3
1719
with:
18-
java-version: 21
20+
java-version: 17
1921
distribution: zulu
2022
- name: Cache local Maven repository
2123
uses: actions/cache@v3
@@ -25,7 +27,7 @@ jobs:
2527
restore-keys: |
2628
${{ runner.os }}-maven-
2729
- name: Analyze with SonarCloud
28-
run: ./mvnw verify jacoco:report sonar:sonar -B -Dsonar.projectKey=mybatis_spring-native -Dsonar.organization=mybatis -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN -Dlicense.skip=true
30+
run: ./mvnw verify jacoco:report sonar:sonar -B -Dsonar.projectKey=mybatis_spring-native -Dsonar.organization=mybatis -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN -Dlicense.skip=true --no-transfer-progress
2931
env:
3032
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3133
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.github/workflows/sonatype.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
name: Sonatype
2+
23
on:
34
push:
45
branches:
56
- master
7+
68
jobs:
79
build:
810
if: github.repository_owner == 'mybatis' && ! contains(toJSON(github.event.head_commit.message), '[maven-release-plugin]')
@@ -12,7 +14,7 @@ jobs:
1214
- name: Set up JDK
1315
uses: actions/setup-java@v3
1416
with:
15-
java-version: 21
17+
java-version: 17
1618
distribution: zulu
1719
- name: Cache local Maven repository
1820
uses: actions/cache@v3
@@ -22,7 +24,7 @@ jobs:
2224
restore-keys: |
2325
${{ runner.os }}-maven-
2426
- name: Deploy to Sonatype
25-
run: ./mvnw deploy -DskipTests -B --settings ./.mvn/settings.xml -Dlicense.skip=true
27+
run: ./mvnw deploy -DskipTests -B -V --no-transfer-progress --settings ./.mvn/settings.xml -Dlicense.skip=true
2628
env:
2729
CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }}
2830
CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }}

.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 2022 the original author or authors.
4+
Copyright 2022-2023 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
@@ -1 +1,2 @@
11
-Daether.checksums.algorithms=SHA-512,SHA-256,SHA-1,MD5
2+
-Daether.connector.smartChecksums=false

.mvn/settings.xml

Lines changed: 7 additions & 2 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 2022 the original author or authors.
4+
Copyright 2022-2023 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.
@@ -24,8 +24,13 @@
2424
<username>${env.CI_DEPLOY_USERNAME}</username>
2525
<password>${env.CI_DEPLOY_PASSWORD}</password>
2626
</server>
27+
<!-- Used for gh-pages-scm publish via maven-scm-publish-plugin -->
2728
<server>
28-
<id>gh-pages</id>
29+
<id>gh-pages-scm</id>
30+
<configuration>
31+
<scmVersionType>branch</scmVersionType>
32+
<scmVersion>gh-pages</scmVersion>
33+
</configuration>
2934
</server>
3035
<server>
3136
<id>github</id>

.mvn/wrapper/MavenWrapperDownloader.java

Lines changed: 21 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* "License"); you may not use this file except in compliance
88
* with the License. You may obtain a copy of the License at
99
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
10+
* https://www.apache.org/licenses/LICENSE-2.0
1111
*
1212
* Unless required by applicable law or agreed to in writing,
1313
* software distributed under the License is distributed on an
@@ -23,85 +23,50 @@
2323
import java.net.PasswordAuthentication;
2424
import java.net.URL;
2525
import java.nio.file.Files;
26-
import java.nio.file.LinkOption;
2726
import java.nio.file.Path;
2827
import java.nio.file.Paths;
2928
import java.nio.file.StandardCopyOption;
30-
import java.nio.file.StandardOpenOption;
31-
import java.util.Properties;
3229

3330
public final class MavenWrapperDownloader
3431
{
35-
private static final String WRAPPER_VERSION = "3.1.1";
32+
private static final String WRAPPER_VERSION = "3.2.0";
3633

3734
private static final boolean VERBOSE = Boolean.parseBoolean( System.getenv( "MVNW_VERBOSE" ) );
3835

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-
6236
public static void main( String[] args )
6337
{
64-
if ( args.length == 0 )
65-
{
66-
System.err.println( " - ERROR projectBasedir parameter missing" );
67-
System.exit( 1 );
68-
}
38+
log( "Apache Maven Wrapper Downloader " + WRAPPER_VERSION );
6939

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 ) )
40+
if ( args.length != 2 )
7441
{
75-
System.err.println( " - ERROR projectBasedir not exists: " + projectBasedir );
42+
System.err.println( " - ERROR wrapperUrl or wrapperJarPath parameter missing" );
7643
System.exit( 1 );
7744
}
7845

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-
8646
try
8747
{
88-
Path outputFile = projectBasedir.resolve( MAVEN_WRAPPER_JAR_PATH );
89-
createDirectories( outputFile.getParent() );
90-
downloadFileFromURL( url, outputFile );
48+
log( " - Downloader started" );
49+
final URL wrapperUrl = new URL( args[0] );
50+
final String jarPath = args[1].replace( "..", "" ); // Sanitize path
51+
final Path wrapperJarPath = Paths.get( jarPath ).toAbsolutePath().normalize();
52+
downloadFileFromURL( wrapperUrl, wrapperJarPath );
9153
log( "Done" );
92-
System.exit( 0 );
9354
}
9455
catch ( IOException e )
9556
{
96-
System.err.println( "- Error downloading" );
97-
e.printStackTrace();
57+
System.err.println( "- Error downloading: " + e.getMessage() );
58+
if ( VERBOSE )
59+
{
60+
e.printStackTrace();
61+
}
9862
System.exit( 1 );
9963
}
10064
}
10165

102-
private static void downloadFileFromURL( String urlString, Path destination ) throws IOException
66+
private static void downloadFileFromURL( URL wrapperUrl, Path wrapperJarPath )
67+
throws IOException
10368
{
104-
log( " - Downloading to: " + destination );
69+
log( " - Downloading to: " + wrapperJarPath );
10570
if ( System.getenv( "MVNW_USERNAME" ) != null && System.getenv( "MVNW_PASSWORD" ) != null )
10671
{
10772
final String username = System.getenv( "MVNW_USERNAME" );
@@ -115,40 +80,11 @@ protected PasswordAuthentication getPasswordAuthentication()
11580
}
11681
} );
11782
}
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 ) )
83+
try ( InputStream inStream = wrapperUrl.openStream() )
13784
{
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-
}
85+
Files.copy( inStream, wrapperJarPath, StandardCopyOption.REPLACE_EXISTING );
14986
}
150-
log( " - Downloading from: " + url );
151-
return url;
87+
log( " - Downloader complete" );
15288
}
15389

15490
private static void log( String msg )

.mvn/wrapper/maven-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# "License"); you may not use this file except in compliance
77
# with the License. You may obtain a copy of the License at
88
#
9-
# http://www.apache.org/licenses/LICENSE-2.0
9+
# https://www.apache.org/licenses/LICENSE-2.0
1010
#
1111
# Unless required by applicable law or agreed to in writing,
1212
# software distributed under the License is distributed on an

0 commit comments

Comments
 (0)