Netbeans IDE 8.0.2 created a new maven project.
This is a brand new project so there are no previous installed dependencies
Trying to add spring dependencies but netbeans only show older versions.
For example
When search the repository it should be 4.0.x How do I fix this?
Thank you
Even thought it might be a new project I imagine your .m2 cache still has all the old version. I'm not sure how NetBeans builds that screen, but if it's based on your cache rather than what's on central you won't see the newer versions until maven pulls them in
--EDIT--
To manually add the dependency go to MvnRepository and search for the dependency on Spring you need, then copy-paste the generate pom dependency entry into your pom.xml then update your dependencies.
Only 1024 of 81415 results shown. Consider narrowing your search
The index search returns the results in fairly random order, so even though Netbeans tries to give you a grouped view, there will be holes because some versions were not included in the 1024 results shown.
A limited number of results is shown for performance reasons. AFAIK.
For reason unknown. You need to type
'org.springframwork'
To yield the newest version.
Any thing like the following will not work
'spring',
'springframework'
Related
In my Java Maven Project I can see the following 2 versions of the one dependency (apache httpcomponents):
How can I ensure that only the newest version (4.5.2) is used in my project?
I cannot even find 4.2.1 declared anywhere within my pom.xml files to remove it.
There should never be two versions of the same dependency for a given project.
So either your IDE shows something wrong here or you did not mvn clean before the build so that old and new dependencies mixed.
Maven will always take only one version. Unfortunately, you cannot tell Maven to take the latest one, but it will always take the nearest one in the dependency tree.
If you want to set the version for a specific dependency, use <dependencyManagement>.
Based on your screenshot you're using IntelliJ. And I have to agree that this view is kind of confusing. In the Project-tab you'll External Libraries which contain all dependencies of all projects in this tab. For that reason dependencies might appear with different versions.
In the Maven-tab (right hand side) you can see the dependency-tree per project. First you'll see the direct dependencies, which you can expand to see the next level of dependencies. AFAIK there's no complete dependency list available in IntelliJ, as one would see with Eclipse.
That's the view of IDE, it shows all the using or used library in your project. Once you point your pom.xml to the new version and rebuild your project, the new version will be used.
In Intellj, you can select: Menu -> File -> Invalidate Caches/Restart to update it. If that won't help, start new project from your existing pom.xml file
Currently I'm in the transition of moving ANT projects to Maven and struggling on how to get the project versioning working correctly. Currently I have about 30+ projects/modules that all rely on each other so everything must be at the latest version to work correctly. This was easily done with ANT but when it comes to Maven I would need to make constant changes to all other released project POM's to allow them to pick up these new changes.
I discussed with a few other developers and we decided we might not even need a maven repo with version numbers, we just have everything at the same version number and build locally or through Jenkins to update our .m2 folders. Does this sound like the correct route for our situation? Are we missing anything doing this?
I did suggest having our test Jenkins to deploy to a repo with version numbers like 1.0.Beta-SNAPSHOT. We have Jenkins setup to build when our testing branches are updated. This means I would not have to locally compile every project on that branch to update my .m2, I could just change the POM to pull all these Beta-SNAPSHOT versions in one place. Would there be a good way for me to do this that would not affect the release if it was pushed and released with this version number set? If I wanted to use my local versions I would then just switch this version number to 1.0.0 which isn't within the repo but my local .m2.
Any suggestions on how to properly manage the maven projects/modules with version numbers would be welcome! Something that reduces the need to change every POM when releasing 1 of the projects/modules would be best!
Our developer struggle with this problem a lot. It is a lot of manual work to update all the POMs for a release.
We are going to aim for multi-module projects, which also seems like a good fit for you.
If you say, that everything must be using the latest versions all the time, I would put all the projects into one large multi-module project. This means that you have one (git) repository with a main POM in the root directory and a directory for each module (sub-project) with its own POM references the main POM as parent.
Then you can run mvn clean install on the parent and build all the modules with consistent version numbers. So releasing is then just one large build.
You should note, though, that you tie the projects (modules) closely together in this way, but it I understood you correctly, they are already tightly interrelated.
The title pretty much sums it up, when I create a new project from a maven archetype it gets an old version of the archetype when I use snapshots. Is there any way to force the updating of the snapshots or at least specify which snapshot I actually want?
I have run in similar issue w.r.t to dependent jars, and finally I think it was the corrupt workspace problem. Creating a new workspace worked for me. Hope it helps.
I'm working on a Maven based web project in Netbeans. The problem is, each time I build the app, it has the same version number in the war, e.g 'myProject-0.0.1.war`. When I deploy it to Amazon EBS I have to manually type in a new version label since it just puts in the name of the war as the version label.
Is there a way to get Netbeans to use an incrementing version number with each build, e.g 0.0.1, 0.0.2, or even just 'myproject-build1000.war', 'myproject-build10001.war' etc?
Although NetBeans is a very Maven-friendly application, the version numbers are very much a Maven thing - NetBeans doesn't have much to do with them.
There does appear to be a solution here:
https://code.google.com/p/autoincrement-versions-maven-plugin/
I've not tried it, but it seems to do what you want.
More generally, to really understand the reasoning behind version numbers in Maven, check out the maven release plugin. On a more practical note, the maven versions plugin is a very useful tool for modifying version numbers in poms.
Warning: I have just picked up Maven, so things mentioned might be wrong or not best practice.
I have a medium size open source project that I am migrating to Maven from the basic
NetBeans project management. This is not a developer team sharing the same room, this is 1-5 people over the internet sharing a SVN repo. Reading over the how-tos on dependencies, it seems that the only way to get dependencies is to get them from an online repo or install them locally.
This is not what I was looking for. I want to keep all dependencies in the SVN for many reasons including portability (anybody can pass by, check out the repo, build, and use; all that simply without manual adding to local repo's and whatnot), getting newer versions (discussed below), and manual versioning.
The other issue I have with the maven repository is that they are quite behind in versions. Logback for example is 0.9.18 in mvnbrowser but 0.9.24 officially. PircBot is 1.4.6 in mvnbrowser but 1.5.0 officially. Why such old versions?
Issue 3 is that I have dependencies that don't even exist in the repos, like Easier Java Persistence.
So
How can I force all dependencies to come from /lib for example
On a related note, can mvn build from library's SVN repo directly? Just curious
Is there an automatic way to get the newest version directly from a dependencies site/svn repo if they also use Maven? IE libraries like commons-lang or logback
Is there a better way of managing dependencies? (IE Ivy or some weird POM option I'm missing)
FYI, this is a Java project with 3 modules, project global dependencies and module specific dependencies.
Bonus points if it can work with the bundled version of Maven that comes with NetBeans.
Not a duplicate of
Maven: add a dependency to a jar by relative path - Not wanting to install to local repository
maven compile fails because i have a non-maven jar - Don't think a System dependency is the right answer
maven look for new versions of dependencies - Still uses(?) repository, just the latest (old) version
This is not what I was looking for. I want to keep all dependencies in the SVN for many reasons (...)
I will come back on this but the solution I described in Maven: add a dependency to a jar by relative path (using a file-based repository) allows to implement such a solution.
The other issue I have with the maven repository is that they are quite behind in versions. Logback for example is 0.9.18 in mvnbrowser but 0.9.24 officially. PircBot is 1.4.6 in mvnbrowser but 1.5.0 officially. Why such old versions?
It looks like mvnbrowser indices are totally out of date (making it useless as repository search engine) because the maven central repository does have logback-core-0.9.24.jar (the logback project is doing what has to be done to make this happen) but only has an old pircbot-1.4.2.jar. Why? Ask the pircbot team. Anyway, you're right, the central repository might not always have ultimate versions.
Issue 3 is that I have dependencies that don't even exist in the repos, like Easier Java Persistence.
Yeah, this happens too.
How can I force all dependencies to come from /lib for example
As previously hinted, you should re-read carefully the solution suggested in Maven: add a dependency to a jar by relative path. This solution is not about installing libraries to the local repository but is about using a file-based repository (that could thus be stored in SVN). You might have missed the point, this matches your use case. And also check Brett's answer for a variation.
On a related note, can mvn build from library's SVN repo directly? Just curious
Didn't get that one. Can you clarify?
Is there an automatic way to get the newest version directly from a dependencies site/svn repo if they also use Maven? IE libraries like commons-lang or logback
Maven supports version ranges and you could use a syntax allowing to use "any version greater than X". But I do NOT recommend using version ranges at all, for the sake of build reproducibility. You don't want the build to suddenly fail because of some automatic update that happened on your back. Only upgrade if you need bug fixes or new features, but do it explicitly (if it ain't broke, don't fix it).
You might also find mentions of the LATEST and RELEASE version markers. I don't recommend them neither for the same reasons as above and even less since they're removed from Maven 3.x.
Is there a better way of managing dependencies? (IE Ivy or some weird POM option I'm missing)
Can't say for Ivy. But in the Maven land, if you can't host up a "corporate" repository for your project (Nexus, Archiva, Artifactory), then the file-based repository is IMO the best approach.
Setup your own Maven repository.
http://archiva.apache.org/