Update dependencies

This commit is contained in:
2023-04-10 11:59:56 +02:00
parent ef7f36982a
commit 19e928e723
3 changed files with 27 additions and 22 deletions

View File

@@ -10,7 +10,7 @@ sourceCompatibility = 11
targetCompatibility = 11 targetCompatibility = 11
version = '1.0' version = '1.0'
compileJava.options.encoding = 'UTF-8' compileJava.options.encoding = 'UTF-8'
compileTestJava.options.encoding = "UTF-8" compileTestJava.options.encoding = 'UTF-8'
repositories { repositories {
mavenLocal() mavenLocal()
@@ -18,22 +18,23 @@ repositories {
} }
dependencies { dependencies {
implementation 'mysql:mysql-connector-java:8.0.30' implementation 'mysql:mysql-connector-java:8.0.32'
implementation 'org.apache.httpcomponents:httpclient:4.5.13' implementation 'org.apache.httpcomponents:httpclient:4.5.14'
implementation 'com.googlecode.json-simple:json-simple:1.1.1' implementation 'com.googlecode.json-simple:json-simple:1.1.1'
implementation 'com.google.code.gson:gson:2.10' implementation 'com.google.code.gson:gson:2.10.1'
implementation platform('com.amazonaws:aws-java-sdk-bom:1.11.896') implementation platform('com.amazonaws:aws-java-sdk-bom:1.12.429')
implementation 'com.amazonaws:aws-java-sdk-s3:1.12.332' implementation 'com.amazonaws:aws-java-sdk-s3:1.12.429'
implementation 'com.google.api-client:google-api-client:2.0.0' implementation 'com.google.auth:google-auth-library-oauth2-http:1.16.0'
implementation 'com.google.oauth-client:google-oauth-client-jetty:1.34.1' implementation 'com.google.api-client:google-api-client:2.2.0'
implementation 'com.google.apis:google-api-services-calendar:v3-rev20220715-2.0.0' implementation 'com.google.apis:google-api-services-calendar:v3-rev20220715-2.0.0'
implementation 'com.google.guava:guava:31.1-jre'
implementation 'commons-cli:commons-cli:1.5.0'
implementation 'net.sourceforge.argparse4j:argparse4j:0.9.0'
implementation 'org.apache.logging.log4j:log4j-api:2.20.0'
implementation 'org.apache.logging.log4j:log4j-core:2.20.0'
implementation 'javax.xml.bind:jaxb-api:2.3.1'
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
compile 'com.google.guava:guava:31.1-jre' testImplementation 'org.testng:testng:7.7.0'
compile group: 'commons-cli', name: 'commons-cli', version: '1.3.1'
compile group: 'net.sourceforge.argparse4j', name: 'argparse4j', version: '0.8.1'
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.14.1'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.14.1'
compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.2.4'
} }
jar { jar {

View File

@@ -1,5 +1,5 @@
#Tue May 26 17:58:07 CEST 2020 #Tue May 26 17:58:07 CEST 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@@ -1,12 +1,13 @@
package de.jeyp91.googlecalendar; package de.jeyp91.googlecalendar;
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport; import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.http.javanet.NetHttpTransport; import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.JsonFactory; import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.gson.GsonFactory; import com.google.api.client.json.gson.GsonFactory;
import com.google.api.services.calendar.CalendarScopes;
import com.google.api.services.calendar.Calendar; import com.google.api.services.calendar.Calendar;
import com.google.api.services.calendar.CalendarScopes;
import com.google.auth.http.HttpCredentialsAdapter;
import com.google.auth.oauth2.GoogleCredentials;
import java.io.*; import java.io.*;
import java.util.Collections; import java.util.Collections;
@@ -27,20 +28,23 @@ public class GoogleCalendarConnector {
* @return An authorized Credential object. * @return An authorized Credential object.
* @throws IOException If the Google_Credentials.json file cannot be found. * @throws IOException If the Google_Credentials.json file cannot be found.
*/ */
private static GoogleCredential getCredentials() throws IOException { private static GoogleCredentials getGoogleCredentials() throws IOException {
InputStream in = GoogleCalendarConnector.class.getResourceAsStream(SERVICE_CREDENTIALS_FILE_PATH); InputStream in = GoogleCalendarConnector.class.getResourceAsStream(SERVICE_CREDENTIALS_FILE_PATH);
return GoogleCredential.fromStream(in) GoogleCredentials credentials = GoogleCredentials.fromStream(in)
.createScoped(Collections.singleton(CalendarScopes.CALENDAR)); .createScoped(Collections.singleton(CalendarScopes.CALENDAR));
credentials.refreshIfExpired();
return credentials;
} }
public static com.google.api.services.calendar.Calendar getSerivce() { public static com.google.api.services.calendar.Calendar getSerivce() {
Calendar service = null;
com.google.api.services.calendar.Calendar service = null;
final NetHttpTransport HTTP_TRANSPORT; final NetHttpTransport HTTP_TRANSPORT;
try { try {
// Build a new authorized API client service.
HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport(); HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport();
service = new Calendar.Builder(HTTP_TRANSPORT, JSON_FACTORY, getCredentials()) service = new Calendar.Builder(HTTP_TRANSPORT, JSON_FACTORY, null)
.setHttpRequestInitializer(new HttpCredentialsAdapter(getGoogleCredentials()))
.setApplicationName(APPLICATION_NAME) .setApplicationName(APPLICATION_NAME)
.build(); .build();