Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,13 @@ updates:
- "> 2.9.9"
- dependency-name: org.apache.derby:derby
versions:
- "> 10.15.0.0"
- "> 10.15.2.0"
- dependency-name: org.apache.derby:derbyoptionaltools
versions:
- "> 10.15.2.0"
- dependency-name: org.apache.derby:derbyshared
versions:
- "> 10.15.2.0"
- dependency-name: org.apache.tomcat:tomcat-catalina
versions:
- "> 9.1.0"
- dependency-name: org.hsqldb:hsqldb
versions:
- ">= 2.6.0"
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
java: [8, 11, 17, 18-ea, 19-ea]
java: [11, 17, 18, 19-ea]
distribution: ['zulu']
fail-fast: false
max-parallel: 4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coveralls.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 8
java-version: 11
distribution: zulu
- name: Report Coverage to Coveralls for Pull Requests
if: github.event_name == 'pull_request'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sonar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: zulu
- name: Analyze with SonarCloud
run: ./mvnw verify jacoco:report sonar:sonar -B -Dsonar.projectKey=mybatis_guice -Dsonar.organization=mybatis -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN -Dlicense.skip=true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sonatype.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: zulu
- name: Deploy to Sonatype
run: ./mvnw deploy -DskipTests -B --settings ./.mvn/settings.xml -Dlicense.skip=true
Expand Down
1 change: 1 addition & 0 deletions .mvn/maven.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-Daether.checksums.algorithms=SHA-512,SHA-256,SHA-1,MD5
4 changes: 2 additions & 2 deletions .mvn/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
limitations under the License.

-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd">
<servers>
<server>
<id>ossrh</id>
Expand Down
146 changes: 83 additions & 63 deletions .mvn/wrapper/MavenWrapperDownloader.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,24 @@
* under the License.
*/

import java.net.*;
import java.io.*;
import java.nio.channels.*;
import java.io.IOException;
import java.io.InputStream;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.nio.file.StandardOpenOption;
import java.util.Properties;

public class MavenWrapperDownloader
public final class MavenWrapperDownloader
{
private static final String WRAPPER_VERSION = "3.1.0";
private static final String WRAPPER_VERSION = "3.1.1";

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

/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
Expand All @@ -49,78 +59,53 @@ public class MavenWrapperDownloader
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";

public static void main( String args[] )
public static void main( String[] args )
{
System.out.println( "- Downloader started" );
File baseDirectory = new File( args[0] );
System.out.println( "- Using base directory: " + baseDirectory.getAbsolutePath() );

// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File( baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH );
String url = DEFAULT_DOWNLOAD_URL;
if ( mavenWrapperPropertyFile.exists() )
if ( args.length == 0 )
{
FileInputStream mavenWrapperPropertyFileInputStream = null;
try
{
mavenWrapperPropertyFileInputStream = new FileInputStream( mavenWrapperPropertyFile );
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load( mavenWrapperPropertyFileInputStream );
url = mavenWrapperProperties.getProperty( PROPERTY_NAME_WRAPPER_URL, url );
}
catch ( IOException e )
{
System.out.println( "- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'" );
}
finally
{
try
{
if ( mavenWrapperPropertyFileInputStream != null )
{
mavenWrapperPropertyFileInputStream.close();
}
}
catch ( IOException e )
{
// Ignore ...
}
}
System.err.println( " - ERROR projectBasedir parameter missing" );
System.exit( 1 );
}
System.out.println( "- Downloading from: " + url );

File outputFile = new File( baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH );
if ( !outputFile.getParentFile().exists() )
log( " - Downloader started" );
final String dir = args[0].replace( "..", "" ); // Sanitize path
final Path projectBasedir = Paths.get( dir ).toAbsolutePath().normalize();
if ( !Files.isDirectory( projectBasedir, LinkOption.NOFOLLOW_LINKS ) )
{
if ( !outputFile.getParentFile().mkdirs() )
{
System.out.println( "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath()
+ "'" );
}
System.err.println( " - ERROR projectBasedir not exists: " + projectBasedir );
System.exit( 1 );
}
System.out.println( "- Downloading to: " + outputFile.getAbsolutePath() );

log( " - Using base directory: " + projectBasedir );

// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
Path mavenWrapperPropertyFile = projectBasedir.resolve( MAVEN_WRAPPER_PROPERTIES_PATH );
String url = readWrapperUrl( mavenWrapperPropertyFile );

try
{
Path outputFile = projectBasedir.resolve( MAVEN_WRAPPER_JAR_PATH );
createDirectories( outputFile.getParent() );
downloadFileFromURL( url, outputFile );
System.out.println( "Done" );
log( "Done" );
System.exit( 0 );
}
catch ( Throwable e )
catch ( IOException e )
{
System.out.println( "- Error downloading" );
System.err.println( "- Error downloading" );
e.printStackTrace();
System.exit( 1 );
}
}

private static void downloadFileFromURL( String urlString, File destination )
throws Exception
private static void downloadFileFromURL( String urlString, Path destination ) throws IOException
{
log( " - Downloading to: " + destination );
if ( System.getenv( "MVNW_USERNAME" ) != null && System.getenv( "MVNW_PASSWORD" ) != null )
{
String username = System.getenv( "MVNW_USERNAME" );
char[] password = System.getenv( "MVNW_PASSWORD" ).toCharArray();
final String username = System.getenv( "MVNW_USERNAME" );
final char[] password = System.getenv( "MVNW_PASSWORD" ).toCharArray();
Authenticator.setDefault( new Authenticator()
{
@Override
Expand All @@ -131,12 +116,47 @@ protected PasswordAuthentication getPasswordAuthentication()
} );
}
URL website = new URL( urlString );
ReadableByteChannel rbc;
rbc = Channels.newChannel( website.openStream() );
FileOutputStream fos = new FileOutputStream( destination );
fos.getChannel().transferFrom( rbc, 0, Long.MAX_VALUE );
fos.close();
rbc.close();
try ( InputStream inStream = website.openStream() ) {
Files.copy( inStream, destination, StandardCopyOption.REPLACE_EXISTING );
}
log( " - Downloader complete" );
}

private static void createDirectories(Path outputPath) throws IOException
{
if ( !Files.isDirectory( outputPath, LinkOption.NOFOLLOW_LINKS ) ) {
Path createDirectories = Files.createDirectories( outputPath );
log( " - Directories created: " + createDirectories );
}
}

private static String readWrapperUrl( Path mavenWrapperPropertyFile )
{
String url = DEFAULT_DOWNLOAD_URL;
if ( Files.exists( mavenWrapperPropertyFile, LinkOption.NOFOLLOW_LINKS ) )
{
log( " - Reading property file: " + mavenWrapperPropertyFile );
try ( InputStream in = Files.newInputStream( mavenWrapperPropertyFile, StandardOpenOption.READ ) )
{
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load( in );
url = mavenWrapperProperties.getProperty( PROPERTY_NAME_WRAPPER_URL, DEFAULT_DOWNLOAD_URL );
}
catch ( IOException e )
{
System.err.println( " - ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'" );
}
}
log( " - Downloading from: " + url );
return url;
}

private static void log( String msg )
{
if ( VERBOSE )
{
System.out.println( msg );
}
}

}
10 changes: 5 additions & 5 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
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.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ MyBatis Guice Module
[![Coverage Status](https://coveralls.io/repos/mybatis/guice/badge.svg?branch=master&service=github)](https://coveralls.io/github/mybatis/guice?branch=master)
[![Maven central](https://maven-badges.herokuapp.com/maven-central/org.mybatis/mybatis-guice/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.mybatis/mybatis-guice)
[![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/https/oss.sonatype.org/org.mybatis/mybatis-guice.svg)](https://oss.sonatype.org/content/repositories/snapshots/org/mybatis/mybatis-guice/)
[![License](http://img.shields.io/:license-apache-brightgreen.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)
[![License](https://img.shields.io/:license-apache-brightgreen.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)

![mybatis-guice](http://mybatis.github.io/images/mybatis-logo.png)

Expand Down
31 changes: 28 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@

-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-parent</artifactId>
<version>34</version>
<version>35</version>
<relativePath />
</parent>

Expand Down Expand Up @@ -192,6 +193,7 @@
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>${annotation-api.version}</version>
<optional>true</optional>
</dependency>

<dependency>
Expand Down Expand Up @@ -247,7 +249,7 @@
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.5.2</version>
<version>2.7.0</version>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -301,7 +303,19 @@
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.14.2.0</version>
<version>10.15.2.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbyshared</artifactId>
<version>10.15.2.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbyoptionaltools</artifactId>
<version>10.15.2.0</version>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -377,6 +391,17 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<configuration>
<rules>
<enforceBytecodeVersion>
<ignoredScopes>test</ignoredScopes>
</enforceBytecodeVersion>
</rules>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/mybatis/guice/AbstractMyBatisModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ final <T> void bindMapper(Class<T> mapperType) {
*
* @param resourceClassLoader
* the resource class loader
*
* @since 3.3
*/
public void useResourceClassLoader(ClassLoader resourceClassLoader) {
Expand All @@ -116,6 +117,7 @@ public void useResourceClassLoader(ClassLoader resourceClassLoader) {
* Gets the resource class loader.
*
* @return the resource class loader
*
* @since 3.3
*/
protected final ClassLoader getResourceClassLoader() {
Expand All @@ -127,6 +129,7 @@ protected final ClassLoader getResourceClassLoader() {
*
* @param driverClassLoader
* the driver class loader
*
* @since 3.3
*/
public void useJdbcDriverClassLoader(ClassLoader driverClassLoader) {
Expand All @@ -137,6 +140,7 @@ public void useJdbcDriverClassLoader(ClassLoader driverClassLoader) {
* Gets the default class loader.
*
* @return the default class loader
*
* @since 3.3
*/
private ClassLoader getDefaultClassLoader() {
Expand Down
Loading