11/*
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- */
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+ http://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+
1620import java .net .*;
1721import java .io .*;
1822import java .nio .channels .*;
1923import java .util .Properties ;
2024
2125public class MavenWrapperDownloader {
2226
23- private static final String WRAPPER_VERSION = "0.5.5" ;
2427 /**
2528 * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
2629 */
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" ;
30+ private static final String DEFAULT_DOWNLOAD_URL =
31+ "https://repo. maven.apache.org/maven2/io/takari/maven -wrapper/0.4.2/maven-wrapper-0.4.2 .jar" ;
2932
3033 /**
3134 * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
@@ -73,13 +76,13 @@ public static void main(String args[]) {
7376 }
7477 }
7578 }
76- System .out .println ("- Downloading from: " + url );
79+ System .out .println ("- Downloading from: : " + url );
7780
7881 File outputFile = new File (baseDirectory .getAbsolutePath (), MAVEN_WRAPPER_JAR_PATH );
7982 if (!outputFile .getParentFile ().exists ()) {
8083 if (!outputFile .getParentFile ().mkdirs ()) {
8184 System .out .println (
82- "- ERROR creating output directory '" + outputFile .getParentFile ().getAbsolutePath () + "'" );
85+ "- ERROR creating output direcrory '" + outputFile .getParentFile ().getAbsolutePath () + "'" );
8386 }
8487 }
8588 System .out .println ("- Downloading to: " + outputFile .getAbsolutePath ());
@@ -95,16 +98,6 @@ public static void main(String args[]) {
9598 }
9699
97100 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- }
108101 URL website = new URL (urlString );
109102 ReadableByteChannel rbc ;
110103 rbc = Channels .newChannel (website .openStream ());
0 commit comments