Maven clean install strange download - java

I have been using maven for a while, since a couple of weeks I started to notice some downloads every time I execute "clean install".
[INFO] Downloading: https://repo1.maven.org/maven2/org/apache/qpid/proton-jms/0.3.0-fuse-2/proton-jms-0.3.0-fuse-2.pom
[INFO] Downloading: https://code.lds.org/nexus/content/groups/main-repo/org/apache/qpid/proton-jms/0.3.0-fuse-2/proton-jms-0.3.0-fuse-2.pom
[INFO] Downloading: http://repo.spring.io/release/org/apache/qpid/proton-jms/0.3.0-fuse-2/proton-jms-0.3.0-fuse-2.pom
[INFO] Downloading: http://repo.spring.io/release/org/apache/qpid/proton/0.3.0-fuse-2/proton-0.3.0-fuse-2.pom
[INFO] Downloading: http://repo.spring.io/release/org/apache/qpid/proton-api/0.3.0-fuse-2/proton-api-0.3.0-fuse-2.pom
I'm guessing that someone add a new dependency into the POM file (maybe spring) but still, it should download just one time right? it is downloading every time for me,
Any suggestions to get rid of this ?

Its not actually download all the dependency from the Internet. If first time issued a mvn command the dependencies mentioned in pom.xml are downloaded from Internet and are saved in your local M2_HOME or local repository. Then if you don't remove these dependencies from the M2_HOME or local repository every next mvn command get/fetch these dependencies from the M2_HOME or local repository.
Maven also display this getting/fetching of jar file as download. You may notice the the later download takes much less time than the first download. Because the later mvn command download/get/fetch these dependencies from he local repository.

Related

How do I get Maven Site Descriptors to deploy to Artifactory?

I'm trying to generate a site for project that has a parent project and getting the following error.
[INFO] Parent project loaded from repository: com.mycompany:java-parent:pom:2.0.8
[INFO] Parent project loaded from repository: com.mycompany:parent:pom:2.0.8
Downloading: http://mycompany.com:8083/artifactory/ecommerce-repos/com/mycompany/parent/java-parent/2.0.8/java-parent-2.0.8-site_en.xml
[INFO] Unable to find resource 'com.mycompany:java-parent:xml:site_en:2.0.8' in repository eecomdev1-eecom (http://mycompany.com:8083/artifactory/ecommerce-repos)
Downloading: http://repo1.maven.org/maven2/com/mycompany/parent/java-parent/2.0.8/java-parent-2.0.8-site_en.xml
[WARNING] Unable to get resource 'com.mycompany:java-parent:xml:site_en:2.0.8' from repository central (http://repo1.maven.org/maven2): Error transferring file: Connection refused
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] SiteToolException: The site descriptor cannot be resolved from the repository: IOException: Unable to locate site descriptor: Permission denied
I'm unsurprised that it can't find it at repo1. A check of our company repository showed that the site_en file has not been deployed to our artifactory.
The site does generate from the machine where we do most of our builds. It turns out that because it built the actual releases for parent and java-parent it has the site_en.xml file in its local repository (the one on the local disk).
I figure to get going I need 1 of 2 possible solutions:
A way to tell the child project to stop trying to find the parent projects site.xml.
A way to deploy the site.xml files to artifactory.
My attempts at finding either solution have failed. The only way I can get the site xml files into the local artifactory is by running a full mvn release:prepare release:perform. I can't figure out how to make it deploy these files to artifactory or how to generate these files without actually doing a release.
Any ideas?
did you try instructions from http://maven.apache.org/plugins/maven-site-plugin/maven-3.html#Site_descriptor_attachment?
with this configuration in place, you should be able to simply mvn deploy
I think that it is related to this open bug https://issues.apache.org/jira/browse/MSITE-639

Maven error: "You don't have a SNAPSHOT project in the reactor projects list."

What on earth does this mean? Cant find any help via google.
> mvn release:prepare
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Base 1.0.5
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-release-plugin:2.3.2:prepare (default-cli) # base ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.386s
[INFO] Finished at: Tue Oct 08 08:22:46 EST 2013
[INFO] Final Memory: 9M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare (default-cli) on project base: You don't have a SNAPSHOT project in the reactor projects list. -> [Help 1]
release:prepare command is supposed to prepare your snapshot project for the release. It sounds like you don't have such a snapshot project.
Here's the full details what it'll do: http://maven.apache.org/maven-release/maven-release-plugin/examples/prepare-release.html
If you're sure you should be releasing, you should be working on a maven module that has version ending with -SNAPSHOT.
Update: like noted by #khmarbaise in the comments, if your release has failed, you should do release:rollback to go back to previous state. Note though that it is not supported if you release through jenkins (jenkins issue), and it won't rollback the tags.
Don't needed manually edit pom.xml.
You can use "mvn versions:set" for batch update, something like this:
mvn versions:set -DnewVersion=1.0.3-SNAPSHOT
I've had the same error with Jenkins. In a previous release, Jenkins updated the version of the POM to a non-snapshot version, but the build failed before Jenkins could set the version to a -SNAPSHOT version again. Afterwards, making a release resulted in the error described above.
Fixing this is easy: just manually change the version of your app in pom.xml to a -SNAPSHOT version.
I know this is an old question but I had this issue recently and I found 2 solutions that others may find useful. I am using bamboo as my CI tool. The issue was that there was an error in the bamboo build leaving bamboo in an incorrect state. It had locally updated my project pom.xml with the new release version but had not checked this into SVN. The two solution that worked for me were:
Either
Delete the bamboo build-dir directory for the project and run the release again: rm -rf /opt/bamboo-home/xml-data/build-dir/PROJECT_NAME-RELEASE-JOB1
OR
Run the maven release from the command line using the following commands:
mvn release:prepare -DignoreSnapshots -Dresume=false
mvn release:perform
No need to update versions manually as that is time consuming, if version change is all you need, there is a different command that only updates the pom versions, just like updating them manually:
mvn versions:set -DgenerateBackupPoms=false -DnewVersion=1.0.XX-SNAPSHOT

Failed build in Jenkins: cannot resolve sqljdbc4 jar

I have started configuring Jenkins with my project. I made sure to install the sqljdbc driver in my local repository first:
$>mvn install:install-file -Dfile=sqljdbc4-4.0.jar
-DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=4.0 -Dpackaging=jar
I can see the jar has apparently been installed successfully at:
C:\Users\ me \.m2\repository\com\microsoft\sqlserver\sqljdbc4\4.0
This is what the pom relevant parts looks like:
<sqljdbc4.version>4.0</sqljdbc4.version>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>${sqljdbc4.version}</version>
</dependency>
However when I try to build the project from jenkins I get:
Executing Maven: -B -f C:\Program Files (x86)\Jenkins\jobs\Build Solutions Project\workspace\pom.xml install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building CommonFrontPage 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://repo.maven.apache.org/maven2/com/microsoft/sqlserver/sqljdbc4/4.0/sqljdbc4-4.0.pom
[WARNING] The POM for com.microsoft.sqlserver:sqljdbc4:jar:4.0 is missing, no dependency information available
I'm not sure why it's not looking in my local repository first.
I also set under "configure" > "Maven Project Configuration":
Local Maven Repository Default (~/.m2/repository)
I restarted the Jenkins service too.
I am not sure how to proceed from here.
I know I could use nexus, but I don't really need it at this stage.
Maven version: 3.0.5
I managed to solve it. Since it was building correctly checking out the repository and using maven from the command line, I figured Jenkins was using a different configuration to resolve the repository, so I explicitly added:
C:/Users/me/.m2/repository
into maven's "setting.xml".
Not sure if it's the most elegant solution but at least it works now.

Problems after Maven installation - mvn install tries to download unreachable files

After installing maven (mvn -v works fine), I tried to do mvn install in a directory having a good pom.xml at the root of a Maven project that I know works.
I get the output shown at the bottom which basically states that it tried to download a file from an online maven repository and failed. The file appears to be maven-oriented and I don't think it's related to my project.
In addition, if I run mvn install in a directory without a pom.xml, which should just fail as I understand it, I get the same problems. I'm guessing my Maven just hasn't been fully set up yet and its configuring itself maybe?
Can anyone tell me why it wants these files, and why it might be failing?
I seem to have access to the URL in chrome and the file being targeted is there, so even if it does need it, I'm baffled about why the download is failing.
C:\>mvn install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO] task-segment: [install]
[INFO] ------------------------------------------------------------------------
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.3/maven-resources-plugin-2.3.pom
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-resources-plugin:pom:2.3' from repository central (http://repo1.maven.org/maven2): Error transferring file: Connection timed out: conne
ct
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.3/maven-resources-plugin-2.3.pom
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-resources-plugin:pom:2.3' from repository central (http://repo1.maven.org/maven2): Error transferring file: Connection timed out: conne
ct
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: org.apache.maven.plugins:maven-resources-plugin
Reason: POM 'org.apache.maven.plugins:maven-resources-plugin' not found in repository: Unable to download the artifact from any repository
org.apache.maven.plugins:maven-resources-plugin:pom:2.3
from the specified remote repositories:
central (http://repo1.maven.org/maven2)
for project org.apache.maven.plugins:maven-resources-plugin
Your gateway is blocking maven from downloading the dependencies.
Try and check whether you are able to download this pom file manually.
http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.3/maven-resources-plugin-2.3.pom
if you are open the above URL from your browser, then check your firewall settings(Sometimes firewall settings also block maven from downloading the dependencies, especially if you are in an enterprise environment).
if that is the case, you need to use a proxy to bypass your gateway and download the dependencies
OR
Download the plugins manually from maven central or nexus repository and install it using maven install command in your local .m2 directory.
maven install -DartifactId="your dependency" -DgroupId="groupID of the
dependency" -DFile="your file location"
As you mentioned in the comments that you are able to open the site from chrome, you can install the dependency using the above command.
Unable to download the artifact from any repository maven:
Check for proxy :if you have some customized jar file related to your company project ,it needs your firewall and if you are using any proxy in setting.xml file then block it to get it downloaded.

Unable to find resource 'com.ibm.icu:icu4j:pom:3.4.1' in any of the repositories

My maven build emits several INFOs like this:
[INFO] ------------------------------------------------------------------------
Downloading: http://repository.springsource.com/maven/bundles/release/com/ibm/icu/icu4j/3.4.1/icu4j-3.4.1.pom
[INFO] Unable to find resource 'com.ibm.icu:icu4j:pom:3.4.1' in repository com.springsource.repository.bundles.release (http://repository.springsource.com/maven/bundles/release)
Downloading: http://repository.springsource.com/maven/bundles/external/com/ibm/icu/icu4j/3.4.1/icu4j-3.4.1.pom
[INFO] Unable to find resource 'com.ibm.icu:icu4j:pom:3.4.1' in repository com.springsource.repository.bundles.external (http://repository.springsource.com/maven/bundles/external)
Downloading: http://repo1.maven.org/maven2/com/ibm/icu/icu4j/3.4.1/icu4j-3.4.1.pom
The build does eventually succeed, but without ever downloading icu4j. Then the next time I build is exactly the same.
I found this very related question. What I don't understand is how does the build succeed if it really can't find the resource? And if it does find it in the end, why is the resource being downloaded again?
I did find my .m2 folder contains a folder by the name of com/ibm/icu/icu4j/3.4.4/, so I'm deducing there is a conflicting dependency somewhere in my pom structure.
How do I resolve this conflict? Again, the project does compile, but it tries to download files on every build, and I'd rather have it compile cleanly.
The build does eventually succeed, but
without ever downloading icu4j
From the message it looks like maven attempts to download the 3.4.1 version of icu4j dependency first from com.springsource.repository.bundles.release, then com.springsource.repository.bundles.external and finally from central (the default).
There is no 3.4.1 version of icu4j in the repository. The project or a dependency in the project has specified this version as a dependency. Hence maven attempts to download it each time it builds.
As it turns, there is a project dependency on 3.4.4 version of icu4j, which gets successfully downloaded. Maven uses this version (as per dependency resolution rules) and hence the build succeeds.
Running mvn dependency:tree should give details of who uses which version of icu4j and make changes appropriately.

Categories