3

I am working at a company where the local machines are working behind a proxy. The proxy requires no authentication. I have a maven project in IntelliJ which works on my laptop but which I cannot get working on the local machine.

  • So I have imported the project on my local machine.
  • Set the proxy settings in IntelliJ
  • Set the proxy settings in my maven settings.xml as shown in this stackoverflow queston

I have also tried the solution presented in this question where I add -DproxySet=true -DproxyHost=myproxy.com -DproxyPort=3128 with my proxy settings.

I keep on getting the following errors. In IntelliJ my pom file says: pom file error

I have also tried mvn -U clean install as suggested here But then I get the following errorstack:

    [INFO] Error stacktraces are turned on.
    [INFO] Scanning for projects...
    [INFO]
    [INFO] ------------------------------------------------------------------------
    [INFO] Building testforce 1.0-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 0.845 s
    [INFO] Finished at: 2018-01-23T11:32:41+01:00
    [INFO] Final Memory: 12M/309M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (http://repo1.maven.org/maven2): Not authorized by proxy , ReasonPhrase:Proxy Authentication Required ( Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied.  ). -> [Help 1]
    org.apache.maven.plugin.PluginResolutionException: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5
            at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:117)
            at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor(DefaultMavenPluginManager.java:181)
            at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:286)
            at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:241)
            at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecution(DefaultLifecycleExecutionPlanCalculator.java:169)
            at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecutions(DefaultLifecycleExecutionPlanCalculator.java:155)
            at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:131)
            at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:145)
            at org.apache.maven.lifecycle.internal.builder.BuilderCommon.resolveBuildPlan(BuilderCommon.java:96)
            at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:110)
            at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
            at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
            at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
            at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
            at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
            at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
            at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
            at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
            at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
            at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
            at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
    Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5
            at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:283)
            at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:199)
            at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:296)
            at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:103)
            ... 26 more
    Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (http://repo1.maven.org/maven2): Not authorized by proxy , ReasonPhrase:Proxy Authentication Required ( Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied.  ).
            at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:453)
            at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:255)
            at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:232)
            at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:268)
            ... 29 more
    Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (http://repo1.maven.org/maven2): Not authorized by proxy , ReasonPhrase:Proxy Authentication Required ( Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied.  ).
            at org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed(ArtifactTransportListener.java:52)
            at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:364)
            at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:76)
            at org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:590)
            at org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:258)
            at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:529)
            at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:430)
            ... 32 more
    Caused by: org.apache.maven.wagon.authorization.AuthorizationException: Not authorized by proxy , ReasonPhrase:Proxy Authentication Required ( Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied.  ).
            at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:1011)
            at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:962)
            at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:126)
            at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
            at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
            at org.eclipse.aether.transport.wagon.WagonTransporter$GetTaskRunner.run(WagonTransporter.java:569)
            at org.eclipse.aether.transport.wagon.WagonTransporter.execute(WagonTransporter.java:436)
            at org.eclipse.aether.transport.wagon.WagonTransporter.get(WagonTransporter.java:413)
            at org.eclipse.aether.connector.basic.BasicRepositoryConnector$GetTaskRunner.runTask(BasicRepositoryConnector.java:456)
            at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:359)
            ... 37 more
    [ERROR]
    [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 read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

So according to the error it has failed to authenticate on the proxy, but the proxy needs no authentication. Any idea's how to tackle this issue?

Mazin
  • 359
  • 2
  • 4
  • 11

2 Answers2

3

Be sure to declare proxy in maven folder/conf/settings.xml:

 <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>https</protocol>
      <username>user</username>
      <password></password>
      <host>proxyhost</host>
      <port>443</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>  

Be sure to link the correct settings.xml in Intellij Project clicking on File\Settings\Maven\User Settings File.

Also your exact error is

org.apache.maven.plugin.PluginResolutionException

It seems you need to declare the dependency's pluginrepo in the pom.xml OR the dependency isn't managed anymore from the oldest repo. Infact the dependency 2.5 is super old, try:

<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-clean-plugin -->
<dependency>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-clean-plugin</artifactId>
    <version>3.0.0</version>
</dependency>

EDIT:

probably due to Proxy settings (Kerberos NTLM proxy maybe) try this in settings.xml:

  <username>DOMAINNAME\USERNAME</username>
Black.Jack
  • 1,878
  • 2
  • 22
  • 39
  • Was one of the first things I tried. (3rd bullet point at the beginning of my question). Difference is I use an http protocol instead of an https – Mazin Jan 23 '18 at 13:53
  • But the error is caused by Authentication not allowed it says in the same line. `Not authorized by proxy , ReasonPhrase:Proxy Authentication Required`. I have added the dependency to the pom and reimported, and also again done `mvn -U clean install` and get the same error message (still with 2.5) – Mazin Jan 23 '18 at 14:25
  • pls try , DOMAINNAME\USERNAME in maven setting. – Black.Jack Jan 23 '18 at 14:35
  • Nope, no luck. I think the maven-clean-plugin is just the first thing that it encounters and for some reason cannot connect with through the proxy... :(. I am assuming we will have the same problem for other dependencies as well – Mazin Jan 23 '18 at 15:11
  • mmm I suggest you to speak with system engineers there...I'm short of idea right now. Last attempt: if you try "mvn clean install" from command line started in the same dir of the pom.xml gives same result? – Black.Jack Jan 23 '18 at 15:17
  • Yeah, that is how I got the error stack that is included in my question.. :( too bad, thanks for the help though, I will try to figure out how to move further. – Mazin Jan 23 '18 at 15:22
  • @Mazin Was this issue resolved somehow? – Anupam Jain Mar 10 '22 at 04:55
-1

Try this, hope it will work.

  • Eclipse -> window -> preferences -> search for proxy -> Network connection ** check the proxy (password should be correct)

  • Go to C:\Users\****\.m2\settings.xml - check the setting.xml file - verfiy these lines ->

<id>http-proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>***host***</host>
<port>8080</port>
<username>***username***</username>
<password>***password***</password>
<nonProxyHosts>****</nonProxyHosts>
</proxy>
Amitesh Singh
  • 162
  • 2
  • 7