How to update maven package after commit/pull-request - maven

I am using a package https://github.com/dhatim/fastexcel, resently there was a commit in their repo, but the version had not been changed in Readme(description) of package in git hub, how can I update the package using maven?
I tried to run mvn release:update-versions, but I get this error
Then I run mvn release:update-versions -X
This is my pom.xml

The git repo is not equal the maven lib. You download maven libraries from the offical maven repository. The maintainer of the library needs to upload his artifact to the central repository when he builds a new release after that you can use this.
To see which version is usable you can use a maven search website like https://search.maven.org.
The dependency org.dhatim:fastexcel has a version 0.9.4 (same as the github release).
So it seems the developer already uploaded it but did not correct his Readme in the repository. So you can just use 0.9.4 in your pom.xml.
So always check the maven search site and if something is missing you can always add an issue to github to ask the developer uploading it.
There are also this more or less recommended possibilites to get library as a workaround:
Checkout and build the project by your self and add the jar file to:
something like nexus as own repository hosting (a organization normally has a maven proxy which could be used)
add it to the pom.xml as system scope dependency where the jar must be located on your system
use mvn install on the fastexcel project and change the version in your pom.xml to 0-SNAPSHOT

Related

How can I compare dependencies with a remote pom file?

We have a maven project which is part of a microservice environment. I want to find out about the latest versions of dependencies (before the release) and update my pom.xml file based on that.
Before, I was using this command:
mvn versions:compare-dependencies -DremotePom=group:artifact:version -DupdatePropertyVersions=true -DupdateDependencies=true
But now, our process is changed and we don't have a built version on our repository before the release and I need something like this:
mvn versions:compare-dependencies -DremotePomFile=http://someurl.com/path/to/our/sourcecontrol/pom.xml -DupdatePropertyVersions=true -DupdateDependencies=true
Is there any solution to use the versions plugin with a remote file instead of a remote pom from a repository?

Maven cannot find richfaces 3.3.x in Central repo

I am trying to follow this tutorial:
http://docs.jboss.org/richfaces/latest_3_3_X/en/cdkguide/html_single/
I am hitting a roadblock with the maven commands.
First the org.richfaces.cdk version 3.3.3.Final was not found in the central repository, so I had to manually install version 4.2.2.Final to my local repository by downloading the file maven-richfaces-resources-plugin-4.2.2.Final.jar
I then had to manually install the org.richfaces.cdk plugin to my local respository.
Next, to run the command in section 4.1. I had to change archetype:create to archetype:generate. Running this command showed that maven couldn't find META-INF/archetype.xml in the jar file. I am stuck at this point. Any pointers?
Per this thread, that version of richfaces is in the JBoss Maven Repo, not Central
https://community.jboss.org/thread/172034?_sscc=t
In general, Software Vendors maintain their own Maven repos and do not push out every release to Central. SpringSource, Atlassian, and Oracle (java.net) come to mind.
Archetypes are dependencies just like project dependencies / plugins, so you will likely need to add the JBoss repository to your pom.xml or settings.xml in order for the archetype to work. See the above link for how to do that.
I figured it out! noahz's answer helped but wasn't the complete solution. I am still going to accept his answer. After substituting the Atlassion repo for the Jboss maven repo in settings.xml, I was still seeing the 'BUILD FAILURE' error saying it couldn't find the richfaces artifact. Maven was still looking in the central repo not in the Atlassian repo. So after a bit of research found that the central repo could be overriden with a tag. Follow this link:http://maven.apache.org/guides/mini/guide-mirror-settings.html.
Build is now successful.

How to deploy JAR to Maven remote repository

Is there any way to put my JAR file in remote repository, so my maven project can get this JAR file from any place via Internet?
I have downloaded and did some fixes in the ReportNG project: https://github.com/dwdyer/reportng .
Using ANT I have compiled this project into JAR, now I want to put it into remote Maven repository, but don't know how I can do that.
Could somebody please suggest me the way, how I can perform that?
If it is a released version you want to make available in maven central follow this guide: http://maven.apache.org/guides/mini/guide-central-repository-upload.html
I'm no github professional but since a maven repo is just a file structure with some meta-data you can put it anywhere maven can read it (ftp, http, ...). so you could create a git repo to host your maven artifacts. see http://cemerick.com/2010/08/24/hosting-maven-repos-on-github/ for an example. (it may be outdated - github may have something like maven repo hosting, I just dont know)
A lightweight way to create your own maven repository is to store it on github. See Hosting a Maven repository on github for more details
I followed sonatype open source project maven deployment guide https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide and successfully deployed the latest version of reportNG into maven central repository. Now maven have both 1.1.3 and 1.1.4
http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.uncommons%22%20AND%20a%3A%22reportng%22
You should do a pull request to the github project. If the maintainer likes your fix he will put it in the next version.
If you need your fix in a remote repo NOW then you'll have to setup your own maven repository.

Share Maven Dependencies with team members using Mercurial

I want to share all the External Jars currently being managed by MAVEN with my other team members. I am using Mercurial as my SCM and i am trying to figure what is the easiest way to commit my entire project (include libs) to a repository so that my team members can clone and get running without severe eclipse configuration?
Maven is there in order to help you retrieving libraries. So that, all you have to do is to commit all your files including the pom.xml (.hg should contains everything in target, and other unrelevant files)
Then your project members can pull the sources and run mvn eclipse:eclipse (see eclipse & maven.
And finally import the project in Eclipse.
That was is they need sources...
If they only need the jars, you must put in your infrastructure a company repo that will handle your deployment using mvn deploy. Some information there maven repo::Intro, take special care at the wagon you could use (ftp, ...)
This way, when you're done with your devel and you have pushed your code, you just have to deploy the jar on your repo.
Doing so, your project member'll have to run mvn -U eclipse:eclipse or any goal to update their local repository with your lastest deployed version.

Maven without Internet connection

I'm new to maven project.
I'm changing an ant project to maven project.
To install the 3rd party jar's in maven local repository, I used install command.
Its trying to download the resource jar.pom.
I don't have download access in my organization so the build failed for installtion.
After request i got the resouce jar and clean jar in my desktop(also i can get other necessary jar).
How to make maven to use these jar for the process and how to install the jar in local repository without internet acess.
I downloaded the jar and placed in local repository but it couldn't point the path and use those jars.
please let me know what steps i have follow to run maven install and other commands to build the project without internet access.
where should i placed the jar which i have downloaded by external way.
Please guide me for building and deploying the project.
Thanks in advance.
http://maven.40175.n5.nabble.com/Maven-installation-and-using-in-project-without-Internet-conncetion-tp4564443p4564443.html.
http://www.coderanch.com/t/544641/Jobs-Offered/careers/Maven-installation-project-without-Internet#2471141
I've posted same question in these link
You need an internet connection. Maven isn't initially self-sufficient. It needs to download a bunch of plugins along with their dependencies and the dependencies of your own project. And this really depends on what sort of settings you have for your projects. One set up will require one set of dependencies, another - a whole different one. You can't download artifacts from the Maven Central manually and then install them locally one by one. Simply put, that sounds stupid.
I understand that you're coming from the Ant world where Ant has everything it needs on the local file system. However, Maven relies on the fact that it will have a central repository (either Maven Central, or your own repository - Nexus, Artifactory, etc.) from which to download the plugins and dependencies it needs. There is no point in you migrating to Maven, unless you'll be allowed access to the Central Maven Repository.
Yes, indeed, you can run Maven offline and you can have Maven produce a local repository for you to use when you are in offline mode. However, what you're trying to do is against Maven's principles.
If your company won't allow access to Maven Central, just stick to Ant. Your effort will be a waste of your company's and, ultimately, your own time.
In fact the maven strenght is mainly in the internet accessible repositories and automatic dependency management. But it's possible to use this tool to build your project if you have all dependencies required for your project in your local repository. Then you may use -o option for offline mode and maven will not try to download updated artefact versions.
To get the artifacts into you local repository you have several options:
1) connect to the internet once and mvn build the project (this will download all required dependencies)
2) install dependencies as jar to the local repository manualy (using appropriate mvn command)
I think the questioner is looking for -o or --offline option for mvn. This is a command line option and can be provided while executing.
I think you can setup your repo correctly and execute the mvn goals once when you are connected to internet and use the -o option for later executions .
Hope this helps.
~Abhay
You can configure maven to run in offline mode. Add this entry to your settings.xml
<offline>true</offline>
See here for further information:
http://maven.apache.org/settings.html
Before you can use offline mode, you have to install all necessary third party jars to your local maven repository.
mvn install:install-file
-Dfile=filename.jar
-DgroupId=com.stackoverflow
-DartifactId=artifact
-Dversion=1.0.0
-Dpackaging=jar
-DcreateChecksum=true
-DgeneratePom=true
It's much easier to get those jars in your local repository using an internet connection and online mode.
It's possible to install these resource jars in your local maven repo using install-file. This will make the available to the build. You'll have to do this for each individually, but once that's done you won't have to do anything special.
To be clear, maven puts everything in your local repository, both the jar you're building with this project and the various library jars. Because your system cannot be connected to the internet to maven can populate the local repo with your libraries, you'll have to use this manual approach.
Edit: You should be able to run install-file anywhere. When you do, you'll need to provide the groupId, artifactId, version, and packaging using the command line options. If you already have a POM file for the library, you can provide that instead via -DpomFile=your-pom.xml.
This question has some useful info: How to manually install an artifact in Maven 2?

Resources