Reputation: 17
When ever i tried to Goals >> Compile pom.xml, I am getting the following error.
An internal error was encountered invoking the maven goal: Please check the exception details.
1) org.apache.httpcomponents:httpcore:jar:4.1.2
Try downloading the file manually from the project website.
Then, install it using the command: mvn install:install-file -DgroupId=org.apache.httpcomponents -DartifactId=httpcore -Dversion=4.1.2 -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there: mvn deploy:deploy-file -DgroupId=org.apache.httpcomponents -DartifactId=httpcore -Dversion=4.1.2 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency: 1) org.apache.httpcomponents:httpcore:jar:4.1.2
1 required artifacts are missing.
As per above error it suggests, Alternatively, if you host your own repository you can deploy the file there. how can i provide a local repository to pom.xml.
Upvotes: 1
Views: 3374
Reputation: 17
To host local repository in pom.xml we have to set up maven properly. we need to modify settings.xml and provide the local repository path in maven packages and then used it with IDE. So now on words if JAR is not available in my local repository then and then only maven tries to search in its maven repository.
please follow below blog to configure maven properly.
http://chiragsdiary.blogspot.in/2013/02/cxf-webservice-example-step-by-step.html
Upvotes: 0
Reputation: 54457
Are you sure your Maven setup works? The artifact you're looking for is in the public Maven repository: http://repo1.maven.org/maven2/org/apache/httpcomponents/httpcore/4.1.2/
It should be found just like any other publicly available artifact. Please check the spelling of the artifact and group in your pom file to make sure that you don't have a typo.
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.1.2</version>
</dependency>
What does Maven print before it fails? It usually says where it's checking for the artifact - does the URL I posted above show up?
Do you see similar issues with other artifacts?
You shouldn't have to host this artifact yourself since it's publicly available. It looks like you're running Maven from an IDE - can you try to run it from command line to see if you get the same error there?
Upvotes: 0
Reputation: 13539
This article explains what you require. Quoting from it:
A maven repository is just a directory somewhere, and that’s about it. In order to use it there are very few steps you need to do.
To put existing libraries into the repository, use the maven deploy command.
To set up your build to read from the repository add the following xml to your pom.xml file:
servername-download description https://host/path
A detailed article for complete understanding of Maven repositories
Upvotes: 0