Comments (3)
I am not sure what you are saying ... setting the env var is tested and works just fine.
from maven-wrapper.
Sorry, I was not precise enough.
Below steps were checked on Win7 and Win10.
- Create maven project somehow or take any if you have it. Lets suppose it's located in c:\app
- Lets suppose we do not have maven in the system, so we install wrapper manually. Download wrapper from https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.tar.gz
- Unpack it into the root of your app dir and delete wrapper jar C:\prj\app.mvn\wrapper\maven-wrapper.jar
- Run this command:
(set MVNW_VERBOSE=true) && (set MVNW_REPOURL=http://localhost) && mvnw.cmd
. With this command we emulate corporate env with local nexus instance. - Check the output:
C:\prj\app>(set MVNW_VERBOSE=true) && (set MVNW_REPOURL=http://localhost) && mvnw.cmd
Couldn't find "C:\prj\app\.mvn\wrapper\maven-wrapper.jar", downloading it ...
Downloading from: "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
Finished downloading "C:\prj\app\.mvn\wrapper\maven-wrapper.jar"
Takari Maven Wrapper 0.5.6
Detected MVNW_REPOURL environment variable http://localhost
Downloading Maven binary from http://localhost/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
As you can see it downloads wrapper jar using predefined URL. MVNW_REPOURL does not affect it.
But wrapper itself as java application takes into account MVNW_REPOURL and works correctly.
-
To fix it add this line:
setlocal EnableDelayedExpansion
right after@echo off
for example
then change line 141
echo Downloading from: %DOWNLOAD_URL%
to
echo Downloading from: !DOWNLOAD_URL!
and finally line 148
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
to
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('!DOWNLOAD_URL!', '%WRAPPER_JAR%')"^
-
and now try again:
C:\prj\app>(set MVNW_VERBOSE=true) && (set MVNW_REPOURL=http://localhost) && mvnw.cmd
Couldn't find "C:\prj\app\.mvn\wrapper\maven-wrapper.jar", downloading it ...
Downloading from: "http://localhost/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
Exception calling "DownloadFile" with "2" argument(s): "Unable to connect to the remote server"
At line:1 char:282
+ ... pe]::Tls12; $webclient.DownloadFile('http://localhost/io/takari/maven ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : WebException
Finished downloading "C:\prj\app\.mvn\wrapper\maven-wrapper.jar"
Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain
Caused by: java.lang.ClassNotFoundException: org.apache.maven.wrapper.MavenWrapperMain
Now it works as expected and downloads wrapper jar according to MVNW_REPOURL var.
from maven-wrapper.
This project is essentially frozen for development and new efforts are ongoing in the Apache Maven project itself. We therefore close this issue. Please find more information at https://github.com/takari/maven-wrapper#ongoing-migration-to-apache-maven and participate in the development there.
from maven-wrapper.
Related Issues (20)
- Running mvnw wrapper from another directory fails HOT 8
- MavenWrapperDownloader issue with JDK 7 HOT 1
- wrapperUrl is wrong HOT 1
- Add url inside file HOT 4
- mvnw fails to download from nexus oss HOT 10
- Bash Instead of sh? HOT 2
- JAVA_HOME HOT 1
- Version 0.7.6 (readme) vs 0.5.5 (maven repository) HOT 2
- Upgrade to Maven 3.6.2 HOT 2
- Add more debug statements HOT 7
- Feature request: Make it possible to exclude wrapper scripts and downloader from the repository HOT 1
- mvnw.cmd properties file parsing bug on win 7 HOT 2
- Add download checksum to maven-wrapper.properties HOT 3
- Update to Maven 3.6.3 as default HOT 6
- Unable to run wrapper with JDK 7 HOT 1
- Maven Wrapper can not be installed behind proxy HOT 1
- maven-wrapper.jar can not be downloaded behind of maven mirror repo HOT 2
- initialization error in mac/os 10.15.2 Catalina HOT 1
- ./mvnw: Warning should be logged to stderr HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from maven-wrapper.