Search code examples
eclipsemavendependencies

Maven Dependency Errors in Eclipse


I am having issues with Maven Eclipse integration. I am able to compile the project using Run as profiles and everything is fine from command prompt too

But in Eclipse Markers I am getting below error when I update/compile

ArtifactDescriptorException: Failed to read artifact descriptor for hiddeninfo:jar:27.0.0-${env}-SNAPSHOT: ArtifactResolutionException: Failure to transfer hiddeninfo:pom:27.0.0-${env}-SNAPSHOT from http ://hiddeninfo/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of public has elapsed or updates are forced.

Original error: Could not transfer artifact hiddeninfo:pom:27.0.0-${env}-SNAPSHOT from/to public (http ://hiddeninfo/nexus/content/groups/public): Illegal character in path at index 106: http ://hiddeninfo/nexus/content/groups/public/hiddeninfo-27.0.0-${envs}-SNAPSHOT.pom

I removed Repository folder and updated again. Still same issue. And I am pretty sure that the reason behind this "$env" which we actually pass as argument.

In a command prompt, this command works:

mvn clean install -Penv-itt

but the following command throws the same error as above:

mvn clean install

So how can I modify the Maven update project to accept arguments or another work-around to get rid of these errors from Eclipse?


Solution

  • I'm assuming you are using m2e? If so, then you can activate a profile for a particular project by looking at the properties and selecting Maven > Active Maven Profiles.

    The fact that the following command line works:

    mvn clean install -P env-itt
    

    means that your POM must have a profile listed called env-itt. Presumably this profile defines a Maven property called env, which explains why your build breaks when you haven't activated the profile.

    Hence, in your case, you should specify env-itt to trigger the correct profile.