Skip to content

Commit db83b8e

Browse files
committed
updated maven wrapper and changed PostgreSQL Driver
1 parent 22bf987 commit db83b8e

File tree

8 files changed

+131
-45
lines changed

8 files changed

+131
-45
lines changed

.mvn/wrapper/MavenWrapperDownloader.java

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,31 @@
11
/*
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-
https://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.File;
21-
import java.io.FileInputStream;
22-
import java.io.FileOutputStream;
23-
import java.io.IOException;
24-
import java.net.URL;
25-
import java.nio.channels.Channels;
26-
import java.nio.channels.ReadableByteChannel;
2+
* Copyright 2007-present the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
import java.net.*;
17+
import java.io.*;
18+
import java.nio.channels.*;
2719
import java.util.Properties;
2820

2921
public class MavenWrapperDownloader {
3022

23+
private static final String WRAPPER_VERSION = "0.5.5";
3124
/**
3225
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
3326
*/
34-
private static final String DEFAULT_DOWNLOAD_URL =
35-
"https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar";
27+
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
28+
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
3629

3730
/**
3831
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
@@ -80,13 +73,13 @@ public static void main(String args[]) {
8073
}
8174
}
8275
}
83-
System.out.println("- Downloading from: : " + url);
76+
System.out.println("- Downloading from: " + url);
8477

8578
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
8679
if(!outputFile.getParentFile().exists()) {
8780
if(!outputFile.getParentFile().mkdirs()) {
8881
System.out.println(
89-
"- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'");
82+
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
9083
}
9184
}
9285
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
@@ -102,6 +95,16 @@ public static void main(String args[]) {
10295
}
10396

10497
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
98+
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
99+
String username = System.getenv("MVNW_USERNAME");
100+
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
101+
Authenticator.setDefault(new Authenticator() {
102+
@Override
103+
protected PasswordAuthentication getPasswordAuthentication() {
104+
return new PasswordAuthentication(username, password);
105+
}
106+
});
107+
}
105108
URL website = new URL(urlString);
106109
ReadableByteChannel rbc;
107110
rbc = Channels.newChannel(website.openStream());

.mvn/wrapper/maven-wrapper.jar

2.32 KB
Binary file not shown.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip
1+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.1/apache-maven-3.6.1-bin.zip
2+
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ Shortcuts
4848
* https://fontawesome.com/icons?d=gallery&m=free
4949
* https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html
5050
* https://ckeditor.com/docs/ckeditor4/latest/guide/dev_installation.html
51+
* http://impossibl.github.io/pgjdbc-ng/docs/current/user-guide/#drivers
52+
* https://devcenter.heroku.com/articles/getting-started-with-java
53+
* https://devcenter.heroku.com/articles/java-support#specifying-a-java-version
5154

5255
# java-getting-started
5356

mvnw

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# "License"); you may not use this file except in compliance
99
# with the License. You may obtain a copy of the License at
1010
#
11-
# https://www.apache.org/licenses/LICENSE-2.0
11+
# http://www.apache.org/licenses/LICENSE-2.0
1212
#
1313
# Unless required by applicable law or agreed to in writing,
1414
# software distributed under the License is distributed on an
@@ -114,7 +114,6 @@ if $mingw ; then
114114
M2_HOME="`(cd "$M2_HOME"; pwd)`"
115115
[ -n "$JAVA_HOME" ] &&
116116
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
117-
# TODO classpath?
118117
fi
119118

120119
if [ -z "$JAVA_HOME" ]; then
@@ -212,7 +211,11 @@ else
212211
if [ "$MVNW_VERBOSE" = true ]; then
213212
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
214213
fi
215-
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"
214+
if [ -n "$MVNW_REPOURL" ]; then
215+
jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
216+
else
217+
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
218+
fi
216219
while IFS="=" read key value; do
217220
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
218221
esac
@@ -221,22 +224,38 @@ else
221224
echo "Downloading from: $jarUrl"
222225
fi
223226
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
227+
if $cygwin; then
228+
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
229+
fi
224230

225231
if command -v wget > /dev/null; then
226232
if [ "$MVNW_VERBOSE" = true ]; then
227233
echo "Found wget ... using wget"
228234
fi
229-
wget "$jarUrl" -O "$wrapperJarPath"
235+
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
236+
wget "$jarUrl" -O "$wrapperJarPath"
237+
else
238+
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
239+
fi
230240
elif command -v curl > /dev/null; then
231241
if [ "$MVNW_VERBOSE" = true ]; then
232242
echo "Found curl ... using curl"
233243
fi
234-
curl -o "$wrapperJarPath" "$jarUrl"
244+
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
245+
curl -o "$wrapperJarPath" "$jarUrl" -f
246+
else
247+
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
248+
fi
249+
235250
else
236251
if [ "$MVNW_VERBOSE" = true ]; then
237252
echo "Falling back to using Java to download"
238253
fi
239254
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
255+
# For Cygwin, switch paths to Windows format before running javac
256+
if $cygwin; then
257+
javaClass=`cygpath --path --windows "$javaClass"`
258+
fi
240259
if [ -e "$javaClass" ]; then
241260
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
242261
if [ "$MVNW_VERBOSE" = true ]; then
@@ -277,6 +296,11 @@ if $cygwin; then
277296
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
278297
fi
279298

299+
# Provide a "standardized" way to retrieve the CLI args that will
300+
# work with both Windows and non-Windows executions.
301+
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
302+
export MAVEN_CMD_LINE_ARGS
303+
280304
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
281305

282306
exec "$JAVACMD" \

mvnw.cmd

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
@echo off
3838
@REM set title of command window
3939
title %0
40-
@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
40+
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
4141
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
4242

4343
@REM set %HOME% to equivalent of $HOME
@@ -117,10 +117,47 @@ for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do s
117117
:endReadAdditionalConfig
118118

119119
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
120-
121120
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
122121
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
123122

123+
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
124+
125+
FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
126+
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
127+
)
128+
129+
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
130+
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
131+
if exist %WRAPPER_JAR% (
132+
if "%MVNW_VERBOSE%" == "true" (
133+
echo Found %WRAPPER_JAR%
134+
)
135+
) else (
136+
if not "%MVNW_REPOURL%" == "" (
137+
SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
138+
)
139+
if "%MVNW_VERBOSE%" == "true" (
140+
echo Couldn't find %WRAPPER_JAR%, downloading it ...
141+
echo Downloading from: %DOWNLOAD_URL%
142+
)
143+
144+
powershell -Command "&{"^
145+
"$webclient = new-object System.Net.WebClient;"^
146+
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
147+
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
148+
"}"^
149+
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
150+
"}"
151+
if "%MVNW_VERBOSE%" == "true" (
152+
echo Finished downloading %WRAPPER_JAR%
153+
)
154+
)
155+
@REM End of extension
156+
157+
@REM Provide a "standardized" way to retrieve the CLI args that will
158+
@REM work with both Windows and non-Windows executions.
159+
set MAVEN_CMD_LINE_ARGS=%*
160+
124161
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
125162
if ERRORLEVEL 1 goto error
126163
goto end

pom.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,61 +196,72 @@
196196
<groupId>org.apache.maven.scm</groupId>
197197
<artifactId>maven-scm</artifactId>
198198
<version>${maven.scm.version}</version>
199+
<scope>provided</scope>
199200
<type>pom</type>
200201
</dependency>
201202
<dependency>
202203
<groupId>org.apache.maven.scm</groupId>
203204
<artifactId>maven-scm-providers-git</artifactId>
204205
<version>${maven.scm.version}</version>
206+
<scope>provided</scope>
205207
<type>pom</type>
206208
</dependency>
207209
<dependency>
208210
<groupId>org.apache.maven.scm</groupId>
209211
<artifactId>maven-scm-providers-standard</artifactId>
210212
<version>${maven.scm.version}</version>
213+
<scope>provided</scope>
211214
<type>pom</type>
212215
</dependency>
213216
<dependency>
214217
<groupId>org.apache.maven.scm</groupId>
215218
<artifactId>maven-scm-providers</artifactId>
216219
<version>${maven.scm.version}</version>
220+
<scope>provided</scope>
217221
<type>pom</type>
218222
</dependency>
219223
<dependency>
220224
<groupId>org.apache.maven.scm</groupId>
221225
<artifactId>maven-scm-managers</artifactId>
222226
<version>${maven.scm.version}</version>
227+
<scope>provided</scope>
223228
<type>pom</type>
224229
</dependency>
225230
<dependency>
226231
<groupId>org.apache.maven.scm</groupId>
227232
<artifactId>maven-scm-provider-local</artifactId>
228233
<version>${maven.scm.version}</version>
234+
<scope>provided</scope>
229235
</dependency>
230236
<dependency>
231237
<groupId>org.apache.maven.scm</groupId>
232238
<artifactId>maven-scm-provider-git-commons</artifactId>
233239
<version>${maven.scm.version}</version>
240+
<scope>provided</scope>
234241
</dependency>
235242
<dependency>
236243
<groupId>org.apache.maven.scm</groupId>
237244
<artifactId>maven-scm-provider-gitexe</artifactId>
238245
<version>${maven.scm.version}</version>
246+
<scope>provided</scope>
239247
</dependency>
240248
<dependency>
241249
<groupId>org.apache.maven.plugins</groupId>
242250
<artifactId>maven-scm-plugin</artifactId>
243251
<version>${maven.scm.version}</version>
252+
<scope>provided</scope>
244253
</dependency>
245254
<dependency>
246255
<groupId>org.apache.maven.scm</groupId>
247256
<artifactId>maven-scm-client</artifactId>
248257
<version>${maven.scm.version}</version>
258+
<scope>provided</scope>
249259
</dependency>
250260
<dependency>
251261
<groupId>org.apache.maven.scm</groupId>
252262
<artifactId>maven-scm-provider-jgit</artifactId>
253263
<version>${maven.scm.version}</version>
264+
<scope>provided</scope>
254265
</dependency>
255266
<dependency>
256267
<groupId>org.springframework.session</groupId>
@@ -292,6 +303,11 @@
292303
<artifactId>spring-boot-starter-tomcat</artifactId>
293304
<scope>provided</scope>
294305
</dependency>
306+
<dependency>
307+
<groupId>com.impossibl.pgjdbc-ng</groupId>
308+
<artifactId>pgjdbc-ng</artifactId>
309+
<version>0.8.2</version>
310+
</dependency>
295311
</dependencies>
296312

297313
<dependencyManagement>

src/main/resources/application.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ spring:
1212
admin:
1313
enabled: true
1414
datasource:
15-
url: jdbc:postgresql://localhost:5432/simpleworklist
15+
url: jdbc:pgsql://localhost:5432/simpleworklist
16+
#url: jdbc:postgresql://localhost:5432/simpleworklist
1617
#jdbcUrl: jdbc:postgresql://localhost:5432/simpleworklist
1718
username: simpleworklist
1819
password: simpleworklistpwd
19-
driverClassName: org.postgresql.Driver
20+
#driverClassName: org.postgresql.Driver
21+
driverClassName: com.impossibl.postgres.jdbc.PGDriver
2022
platform: POSTGRESQL
2123
jpa:
2224
show-sql: true
@@ -71,17 +73,17 @@ org:
7173
spring:
7274
profiles: default
7375
datasource:
74-
url: jdbc:postgresql://localhost:5432/simpleworklist_default
76+
url: jdbc:pgsql://localhost:5432/simpleworklist_default
7577
---
7678
spring:
7779
profiles: developing
7880
datasource:
79-
url: jdbc:postgresql://localhost:5432/simpleworklist_developing
81+
url: jdbc:pgsql://localhost:5432/simpleworklist_developing
8082
---
8183
spring:
8284
profiles: travis
8385
datasource:
84-
url: jdbc:postgresql://localhost:5432/simpleworklist_travis
86+
url: jdbc:pgsql://localhost:5432/simpleworklist_travis
8587
continue-on-error: true
8688
jpa:
8789
show-sql: false
@@ -95,7 +97,7 @@ server:
9597
spring:
9698
profiles: testing
9799
datasource:
98-
url: jdbc:postgresql://localhost:5432/simpleworklist_testing
100+
url: jdbc:pgsql://localhost:5432/simpleworklist_testing
99101
jpa:
100102
show-sql: false
101103
hibernate:
@@ -131,7 +133,7 @@ logging:
131133
spring:
132134
profiles: qa
133135
datasource:
134-
url: jdbc:postgresql://localhost:5432/simpleworklist_qa
136+
url: jdbc:pgsql://localhost:5432/simpleworklist_qa
135137
continue-on-error: true
136138
jpa:
137139
show-sql: false
@@ -168,7 +170,7 @@ logging:
168170
spring:
169171
profiles: prod
170172
datasource:
171-
url: jdbc:postgresql://localhost:5432/simpleworklist
173+
url: jdbc:pgsql://localhost:5432/simpleworklist
172174
continue-on-error: true
173175
jpa:
174176
show-sql: false

0 commit comments

Comments
 (0)