GithubHelp home page GithubHelp logo

Comments (3)

mosabua avatar mosabua commented on August 24, 2024

I am not sure what you are saying ... setting the env var is tested and works just fine.

from maven-wrapper.

Og1001 avatar Og1001 commented on August 24, 2024

Sorry, I was not precise enough.

Below steps were checked on Win7 and Win10.

  1. Create maven project somehow or take any if you have it. Lets suppose it's located in c:\app
  2. 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
  3. Unpack it into the root of your app dir and delete wrapper jar C:\prj\app.mvn\wrapper\maven-wrapper.jar
  4. 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.
  5. 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.

  1. 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%')"^

  2. 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.

mosabua avatar mosabua commented on August 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.