The situation: we have a Jenkins job that builds a jar and publishes it to Artifactory, in a custom maven repo. The pom and maven-metadata.xml files are generated, and Anonymous has been given read access to the repository. I've added the repository to my maven settings.xml and verified that maven sees the profile containing the artifactory settings. Despite all this, artifactory still won't resolve the dependency, even though everything looks like it should work. We're just integrating Artifactory into our build process, so we don't have any Artifactory expertise, and Google hasn't turned up anything helpful so far.
UPDATE: I located the original problem - Artifactory couldn't locate the jar in the repo because it wanted an exact match to the jar name, including the timestamp, which is useless for maven. Having fixed that, I'm now running into a further problem.
From the Artifactory log:
2017-11-17 10:09:15,838 [http-nio-8081-exec-2] [WARN ]
(o.a.r.RemoteRepoBase:437) - jcenter: Error in getting information for
'org/tiaacref/ted/digital-metrics-commons/1.1-SNAPSHOT/digital-metrics-commons-1.1-SNAPSHOT.jar'
(Failed retrieving resource from
https://jcenter.bintray.com/org/tiaacref/ted/digital-metrics-commons/1.1-SNAPSHOT/digital-metrics-commons-1.1-SNAPSHOT.jar:
Unknown host - jcenter.bintray.com).
Why is Artifactory going to an external URL to try to resolve an artifact contained in a local repository???
Related
I am getting an error while adding poi - ooxlm dependency in my Rest assured project . I need to add Excel file interaction to handle data .
The error I am getting is "Could not transfer artifact org.apache.poi:poi-ooxml-lite:jar:5.2.2 from/to snapshots (https://artifacts.apple.com/libs-snapshot): artifacts.apple.com org.eclipse.aether.transfer.ArtifactTransferException: Could
not transfer artifact org.apache.poi:poi-ooxml-lite:jar:5.2.2 from/to snapshots (https://artifacts.apple.com/libs-snapshot): artifacts.apple.com at "
my pom.xml is
You don't show much of the relevant parts of your pom.xml; also including the relevant snippets as text is easier than a screenshot.
But org.apache.poi:poi-ooxml-lite is available on maven central, so that's where your project should look.
https://artifacts.apple.com/libs-snapshot does not resolve for me, this might be a company internal maven repository that you're using?
There are a few things you can check:
Open the file .m2\repository\org\apache\poi\poi-ooxml-lite\5.2.2\poi-ooxml-lite-5.2.2.jar.lastUpdated and check the error message for each repository. Check why it can't reach maven central; is it missing from the list or giving an error? This might be a company firewall/policy issue perhaps? Or is it giving an error on HTTPS/TLS protocol level?
Check with mvn help:effective-pom what your current listed (plugin) repositories are
Check if you can add maven central to your repositories list if it's missing somehow (should be included by default). Check if it's HTTP or HTTPS, only secure is supported now.
Check in your main maven repository which versions of this jar are available / mirrored, and depend on that version instead (if you can't get maven central to work).
Run your maven command with -X for debug mode to investigate further
I don't understand following error I am getting while executing : mvn install
I have the javax.transaction:jta:jar:1.0.1B artifact in my m2 repository and I did make sure that the maven is looking at the right repository (By running mvn -X)
Has anybody ever experienced and resolved this kind of error.
Failure to find javax.transaction:jta:jar:1.0.1B in https://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
I had this same problem. The jar was installed in my local .m2 directory.
I had the pom.xml updated with the dependency element for the jar file.
I even added the localRepository element in a local settings.xml (even though this is the default and shouldn't be needed).
The authorities on the directories was what is required:
drwxr-xr-x on directories and -rw-r--r-- on the files in the respository
none of the other items in the list from the DependencyResolutionException were helpful
I decided to try running with sudo on the mvn install and this made the difference (I am on a mac if that matters):
sudo mvn install:install-file -DgroupId=com.nav.abc - DartifactId=xy.abc -Dversion=1.0.0 -Dpackaging=jar - Dfile=abcAdapter/xy.abc.jar
And now it seems to be working!
I don't see any difference in the access authorities on the directories so I'm not sure how this made any difference... but it does work
Since you say the jar is in your local .m2, it is strange that Maven still goes to the central repo to find it, ideally it should not. I am thinking it might be related to a different dependency, for example like in this thread. Could you check if yours if the same scenario?
The other thing you could do is look for a repository where this version of JTA exists and add that repository to your settings.xml or pom.xml, however you have that configured.
One another option is you could try with a different version of JTA jar and see if you run in to the same issue.
Go to the folder contains javax.transaction:jta:jar:1.0.1B in your .m2 and then delete this file _remote.repositories
I get the following error:
The following artifacts could not be resolved: com.sun.jdmk:jmxtools:jar:1.2.1, com.sun.jmx:jmxri:jar:1.2.1: Failure to find com.sun.jdmk:jmxtools:jar:1.2.1 in https://artifactory.corp.adobe.com/artifactory/maven-identity-snapshot was cached in the local repository, resolution will not be reattempted until the update interval of artifactory-snapshot
However, both jars are in the Maven cache (.m2 folder) on my machine. I mean files named: jmxri-1.2.1.jar and jmxtools-1.2.1.jar. They are respectively in the folders com/sun/jmdk/jmxtools/1.2.1/ and com/sun/jmx/jmxri/1.2.1
EDIT: When I try the -o switch on Maven to force it to use the local jars, it says the artifact has not been downloaded before. Which is probably true since indeed the artifact is not in the repo but was copied from some other place to my Maven cache -- is it possible to force Maven to use the jars? The -o switch does not seem to force this and Maven seems to be able to detect that the artifact was not downloaded.
Try to delete corresponding artifact folders in maven local repo and rerun or just rerun using -U flag.
Which is probably true since indeed the artifact is not in the repo but was copied from some other place to my Maven cache
Manually copying jars is not the correct way to put artifacts into maven local repo. You should use mvn install:install-file instead. More details here: Guide to installing 3rd party JARs
The dependency on those jars is usually a consequence of a bug in the pom.xml for log4j 1.2.15.
Update to 1.2.16 or 1.2.17 and you will not need these jars any longer.
These particular artefacts date back to a time when Sun licensing did not permit the hosting of the actual jars in a public maven repository.
You were required to accept licence conditions, download them yourself and then manually install either into your local repo (using mvn install:install-file) or into your corporate repository manager (typically using a UI that it provides or mvn deploy:deploy-file).
I am new to programming web applications, and so far I am working with a eclipse/maven-setup with a Jetty server, to develop java web-apps.
One thing I do not understand however, is the dynamics of including external jars. Many tutorials, and Q&A's here on SO claims that it is enough to add the jar to WEB-INF/lib. other explain how I need to add them as dependencies in pom.xml. I have found that some times the first solution works, while some times I also need to add the dependency. I am not sure why it is this way. In addition, when adding dependencies, I have manually copied the external .jars to folders matching the already excisting repository resources. I can't believe that this is the right way to do it, but it has been working out for me.
So my questions are:
Am I correct that the jars need to be double referenced, or am I making a work around for a possible other problem?
What is the difference between the two methods of import/referral?
Bonus Question: Why are the errors below showing up in eclipse? These refers to all of the jars I have tagged as dependencies in pom.xml. The web-app runs as it should, although with seemingly random different runtime errors after a period of time. Restart of the server fixes it at the moment.
Description Resource Path Location Type
Missing artifact standard:standard:jar:1.1.2 pom.xml /WebApp line 1 Maven Dependency Problem
Missing artifact jstl:jstl:jar:1.2 pom.xml /WebApp line 1 Maven Dependency Problem
Missing artifact junit:junit:jar:4.8.2 pom.xml /WebApp line 1 Maven Dependency Problem
ArtifactDescriptorException: Failed to read artifact descriptor for javax.servlet:javaee-web-api:jar:6.0: ArtifactResolutionException: Failure to transfer javax.servlet:javaee-web-api:pom:6.0 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 javax.servlet:javaee-web-api:pom:6.0 from/to central (http://repo.maven.apache.org/maven2): connection timed out to http://repo.maven.apache.org/maven2/javax/servlet/javaee-web-api/6.0/javaee-web-api-6.0.pom pom.xml /WebApp line 1 Maven Dependency Problem
Missing artifact com4j:com4j:jar:1.0 pom.xml /WebApp line 1 Maven Dependency Problem
WebApp Unknown Validation Message
WebApp Unknown Validation Message
WebApp Unknown Validation Message
(Yes there is a total of 8 errors, whereof 3 is completely empty in eclipse.
There is not any difference at all. Maven's pom.xml helps to download all jar files at .m2/repository location. These jars can be used for different projects. You need not to manually download. But for the very first time you need internet connection to download all jar files.
In pom.xml we have to set dependencies like given below or whatever version of jars you want to download. If later point in time you want to change the version ( in following case ${spring.version} then you have to change only one place and everywhere get reflected.
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
If you don't use pom.xml then while transfering project you will have to transfer all jar files over the network many times.
Maven give re-usability of jar files in multiple project. You need not to have deep copy of all jar files in WEB-INF/lib folder.
EDIT 1
In very first attempt, any project will download all jar files from internet and will store all those jar files at .m2/repository. Second time in another project, when you try to use other pom.xml file then maven will try to find jars at local (your computer) .m2/repository whatever dependencies defined in your new project's pom.xml if those files are there in .m2/repository then maven will not try to connect to internet to download (because everything is downloaded at .m2/repository).
If pom.xml file finds new entry then it will connect to internet and then download at .m2/repository
EDIT 2
Maven first checks dependency at local repository (.m2/repository), if not found then maven central repository (needs internet connection) and even if maven is not able to find at central repository then we have to tell those thing into the pom.xml file to download it from some other location.
For Ex.
<repositories>
<repository>
<id>java.net</id>
<url>https://maven.java.net/content/repositories/public/</url>
</repository>
</repositories>
maven is a build tool, which also manages your project dependencies. It helps you build your project outside Eclipse as well. You should either use maven or directly manage your project dependencies in (or outside) Eclipse on your own. In the latter case, possibly you don't need maven.
As for the bonus question, looks like there are some connection issues which is resulting in artifacts not getting downloaded (connection timed out) - maybe your system is behind a proxy server.
This is the error that I am getting with my current Maven Android Project.
The POM for com.google.android.gms:google-play-services:jar:13.0.0 is missing, no dependency information available
I have tried reinstalling google play services from SDK Manager and running mnv clean install still it does not work.
Any idea how to resolve this.
you need to make sure maven can access the repository the artifact can be found in. For example maven central http://search.maven.org/ does not contain the that artifact.
I would expect a settings.xml or a pom.xml to contain some section in that define where to look for this.
if you can execute maven commands try: mvn help:effective-settings
and as well: mvn help:effective-pom
that should reveal some repositories.
Another issue may be that you need to configure a proxy server for maven if you are behind one.
Is the message a warning or an error? Because it is also common that some artifacts do not have a pom.xml. So if it is a warning but everything else works just ignore it :)