facebook

Configuring Proxy for Maven

  1. MyEclipse IDE
  2.  > 
  3. Maven for MyEclipse (Maven4MyEclipse)

Tagged: 

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #347552 Reply

    peez
    Member

    I’m working in a company where I need a proxy to get to the outside world. I haven’t managed to tell maven the proxy – at least I think that’s the problem. When trying to create or update a maven project I keep getting an error message.

    This are the appropriate log entries:

    
    !MESSAGE Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5
    !STACK 0
    org.apache.maven.plugin.PluginResolutionException: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5
        at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:129)
        at org.eclipse.m2e.core.internal.project.registry.EclipsePluginDependenciesResolver.resolve(EclipsePluginDependenciesResolver.java:48)
        at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor(DefaultMavenPluginManager.java:142)
        at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:261)
        at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:185)
        at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecution(DefaultLifecycleExecutionPlanCalculator.java:152)
        at org.eclipse.m2e.core.internal.embedder.MavenImpl.setupMojoExecution(MavenImpl.java:386)
        at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.setupMojoExecution(ProjectRegistryManager.java:870)
        at org.eclipse.m2e.core.internal.project.registry.MavenProjectFacade.getMojoExecution(MavenProjectFacade.java:355)
        at org.eclipse.m2e.core.project.configurator.AbstractCustomizableLifecycleMapping.getBuildParticipants(AbstractCustomizableLifecycleMapping.java:66)
        at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:120)
        at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:726)
        at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
        at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
        at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
        at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
        at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
        at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
        at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
        at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
        at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
        at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
    Caused by: org.sonatype.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5
        at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:296)
        at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:186)
        at org.sonatype.aether.impl.internal.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:279)
        at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:115)
        ... 22 more
    Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom:2.5 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.5 from/to central (http://repo.maven.apache.org/maven2): Connection refused: no further information to http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.5/maven-resources-plugin-2.5.pom
        at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:538)
        at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216)
        at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:193)
        at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:281)
        ... 25 more
    Caused by: org.sonatype.aether.transfer.ArtifactTransferException: Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom:2.5 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.5 from/to central (http://repo.maven.apache.org/maven2): Connection refused: no further information to http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.5/maven-resources-plugin-2.5.pom
        at org.sonatype.aether.impl.internal.DefaultUpdateCheckManager.newException(DefaultUpdateCheckManager.java:237)
        at org.sonatype.aether.impl.internal.DefaultUpdateCheckManager.checkArtifact(DefaultUpdateCheckManager.java:216)
        at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:427)
        ... 28 more
    

    The message is “connection refused” so I assume that it’s something with the proxy.
    Eclipse Network Settings are set up properly.

    Google told me that I should have a settings.xml set up for Maven4MyEclipse. Already did this, it looks like this:

    
    <?xml version="1.0" encoding="UTF-8"?>
    <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                          http://maven.apache.org/xsd/settings-1.0.0.xsd">
        <proxies>
            <proxy>
                <active>true</active>
                <protocol>http</protocol>
                <host>proxy_http.mycompany.de</host>
                <port>8000</port>        
                <username></username>
                <password></password>    
            </proxy>
        </proxies>
    </settings>
    

    But I’m still getting that message. Any Idea how to fix that?

    #347559 Reply

    support-swapna
    Moderator

    Peez,

    Sorry that you are seeing this issue.

    1. Can you please go to Window>Preferences>MyEclipse>Maven4MyEclipse>User Settings and check if the path to the settings.xml is right?

    2. Make sure there are no extra spaces at the start of the settings.xml file. Please make sure the host,username and password are correct in the settings.xml.Also check if the proxy is working by trying to telnet it : telnet [proxy] [port number]

    Let us know how it works for you.

    #347560 Reply

    peez
    Member

    Just double checked it – the path to settings.xml is correct, also there is no whitespace at the beginning.
    Proxy is working with telnet and also with the main eclipse proxy settings.

    #347576 Reply

    support-swapna
    Moderator

    Peez,

    1. Please attach the complete .log file which is located at <workspace dir>/.metadata/.log to help us investigate further.

    2. Can you please try doing a maven build outside of MyEclipse, but using the project in the workspace and see how it works ?

    3. Can you please also telnet repo.maven.apache.org [port number] to rule out networking issues?

    4. Also share the MyEclipse Installation Details from MyEclipse > Installation Summary > Installation Details.

    Let us know how it works for you.

    #347577 Reply

    peez
    Member

    Log and Installation Details are attached.

    Since the repos are http i assume you mean port 80 to try the telnet? Can’t get a connection but that’s no wonder in my opinion because as far as I know I can’t tell the windows telnet client to use a proxy.

    I haven’t used maven outside eclipse yet, so I’ll try that as soon as I find some time for it. Do I need a dedicated maven installation for this or is it possible to use the maven that’s shipped with MyEclipse?

    Attachments:
    You must be logged in to view attached files.
    #347606 Reply

    support-swapna
    Moderator

    Peez,

    Thank you for the log file.

    1. Can you please try a maven build from a downloaded maven installation and see how it works?

    2. You could also use the debug setting on a maven run in MyEclipse, which would hopefully give a fuller picture when running from within MyEclipse. To set up the debug, Run As->Maven Build , set the Debug output option and specify a goal (e.g. compile) then Run.

    Let us know how it works for you.

    #472152 Reply

    rasha
    Participant

    in my opinion because as far as I know I can’t tell the windows telnet client to use a proxy.

    #472243 Reply

    support-tony
    Keymaster

    rasha,

    This article might help in testing a proxy with telnet.

    Please let us know how your testing with a separate maven installation goes, as per Swapna’s last reply.

    #477188 Reply

    sudhas
    Participant

    Hi ,

    I face the same issue with maven project build ,when I given mvn package I am getting below error,Can anyone please help me resolving this issue I am scratching my head from past 2 days .

    ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its
    dependencies could not be resolved: Failed to read artifact descriptor for org.
    apache.maven.plugins:maven-resources-plugin:jar:2.6: Could not transfer artifact
    org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from/to central (https:
    //repo.maven.apache.org/maven2): Connect to localhost:8080 [localhost/127.0.0.1]
    failed: Connection refused: connect -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
    ch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please rea
    d the following articles:

    Thanks,
    Sudha

    #477220 Reply

    support-swapna
    Moderator

    Sudha,

    Sorry that you are seeing this issue. I assume you are behind a firewall/proxy.

    1. Can you please clarify if you have set up Network Connections (Window > Preferences > General > Network Connections) in MyEclipse IDE?

    2. Can you please go to Window>Preferences>MyEclipse>Maven4MyEclipse>User Settings and check if it points to the correct settings.xml ? Also ensure that correct proxy details are specified in the settings.xml.

    3. Please also telnet repo.maven.apache.org [port number] to rule out networking issues?

    4. If you have a maven installation outside of MyEclipse/Eclipse, then you can check if the build works fine. If there isn’t one, then you could also use the debug setting on a maven run in MyEclipse, which would hopefully give a fuller picture when running from within MyEclipse. To set up the debug, Run As->Maven Build , set the Debug output option and specify a goal (e.g. compile) then Run. Share the output with us.

    5. Please also send us the .log file located at <workspace dir>/.metadata/.log to help us investigate further. Also share with us the MyEclipse Installation Details from menu MyEclipse > Installation Summary > Installation Details.

    Let us know how it works.

    –Swapna
    MyEclipse Support

    #477271 Reply

    sudhas
    Participant

    Hi Swapna,

    I am not using eclipse IDE,just building the project outside by giving mvn package.

    And I don’t have any proxy setting in my system .Anything need to be added in my environment please clarify.

    Thanks,
    Sudha

    #477279 Reply

    support-swapna
    Moderator

    Sudha,

    A connection refused most probably means you are behind a proxy and so you should set up settings.xml with the proxy information.
    Can you please clarify if you are a MyEclipse user? If not, then I am afraid we cannot provide further support.
    I suggest you cross post to java/maven development related forums like stackoverflow.com for better support.

    –Swapna
    MyEclipse Support

    #619589 Reply

    abhinav-sinha12
    Participant

    use below it will work like charm :P. It worked for me !

    1. Download the wagon-http-lightweight-2.2.jar from http://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-http-lightweight/2.2/wagon-http-lightweight-2.2.jar
    2. Copy the wagon-http-lightweight-2.2.jar to %M2_HOME%/lib/ext folder.

    #637622 Reply

    poovendirans
    Participant

    Hi,

    I was using the following mirror configuration in settings.xml
    <mirror>
    <id>central-no-ssl</id>
    <name>Central withou ssl</name>
    <url>http://repo.maven.apache.org/maven2</url&gt;
    <mirrorof>central</mirrorof>
    </mirror>
    As maven url updated to https://repo.maven.apache.org/maven2, i tried with updated url in place of existing http url. But it doesn’t work
    Kindly help me in the proxy configuration
    Thanks

    #637625 Reply

    support-swapna
    Moderator

    Hi,

    It is not clear if you have set the proxy details in the settings.xml along with setting them up in the IDE here : Window > Preferences > General > Network Connections.

    Please see these links for more details (You can follow the same steps in MyEclipse)
    https://www.javahelps.com/2015/08/set-proxy-for-maven-in-eclipse.html
    https://maven.apache.org/guides/mini/guide-proxies.html

    Hope this helps. I also suggest you cross post to development related forums for help with proper configuration of settings.xml.

    –Swapna
    Genuitec Support

Viewing 15 posts - 1 through 15 (of 15 total)
Reply To: Configuring Proxy for Maven

You must be logged in to post in the forum log in