FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
solid-client-java/.mvn/wrapper/MavenWrapperDownloader.java at main · maddingo/solid-client-java · GitHub
maddingo
solid-client-java
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
solid-client-java
/
.mvn
/
wrapper
/
MavenWrapperDownloader.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
98 lines (89 loc) · 3.26 KB
Breadcrumbs
solid-client-java
/
.mvn
/
wrapper
/
MavenWrapperDownloader.java
Copy path
File metadata and controls
98 lines (89 loc) · 3.26 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* 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
*
* 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.
*/
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
.
Path
;
import
java
.
nio
.
file
.
Paths
;
import
java
.
nio
.
file
.
StandardCopyOption
;
public
final
class
MavenWrapperDownloader
{
private
static
final
String
WRAPPER_VERSION
=
"3.2.0"
;
private
static
final
boolean
VERBOSE
=
Boolean
.
parseBoolean
(
System
.
getenv
(
"MVNW_VERBOSE"
) );
public
static
void
main
(
String
[]
args
)
{
log
(
"Apache Maven Wrapper Downloader "
+
WRAPPER_VERSION
);
if
(
args
.
length
!=
2
)
{
System
.
err
.
println
(
" - ERROR wrapperUrl or wrapperJarPath parameter missing"
);
System
.
exit
(
1
);
}
try
{
log
(
" - Downloader started"
);
final
URL
wrapperUrl
=
new
URL
(
args
[
0
] );
final
String
jarPath
=
args
[
1
].
replace
(
".."
,
""
);
// Sanitize path
final
Path
wrapperJarPath
=
Paths
.
get
(
jarPath
).
toAbsolutePath
().
normalize
();
downloadFileFromURL
(
wrapperUrl
,
wrapperJarPath
);
log
(
"Done"
);
}
catch
(
IOException
e
)
{
System
.
err
.
println
(
"- Error downloading: "
+
e
.
getMessage
() );
if
(
VERBOSE
)
{
e
.
printStackTrace
();
}
System
.
exit
(
1
);
}
}
private
static
void
downloadFileFromURL
(
URL
wrapperUrl
,
Path
wrapperJarPath
)
throws
IOException
{
log
(
" - Downloading to: "
+
wrapperJarPath
);
if
(
System
.
getenv
(
"MVNW_USERNAME"
) !=
null
&&
System
.
getenv
(
"MVNW_PASSWORD"
) !=
null
)
{
final
String
username
=
System
.
getenv
(
"MVNW_USERNAME"
);
final
char
[]
password
=
System
.
getenv
(
"MVNW_PASSWORD"
).
toCharArray
();
Authenticator
.
setDefault
(
new
Authenticator
()
{
@
Override
protected
PasswordAuthentication
getPasswordAuthentication
()
{
return
new
PasswordAuthentication
(
username
,
password
);
}
} );
}
try
(
InputStream
inStream
=
wrapperUrl
.
openStream
() )
{
Files
.
copy
(
inStream
,
wrapperJarPath
,
StandardCopyOption
.
REPLACE_EXISTING
);
}
log
(
" - Downloader complete"
);
}
private
static
void
log
(
String
msg
)
{
if
(
VERBOSE
)
{
System
.
out
.
println
(
msg
);
}
}
}
Back
|
FazBrowse Home
|
New Git URL