I have a situation where my system has one maven installed (e.g version 3.7.1. I have some projects that needs that version so this version is my default and if I build a project using mvn the version 3.7.1 is used by default to build the project.
Now I have to work on a project where it needs maven version 3.8.1 and I am looking for a way to do it. I am planning to install the maven version 3.8.1 in same system and would like to call this maven while building the new project. Can anyone help me on how to add envionment variable for new maven and call it whenever necessary while building without removing the 3.7.1 version
Aside from having separate Maven installations on your system, you could also have a look at the Maven Wrapper.
The maven wrapper allows you to attach a small script to your code base, which downloads and runs a specific version of Maven. In this way there are no dependencies to any Maven installations on your system.
After placing the Maven Wrapper in your project, you would then simply run ./mvnw install instead of mvn install.
I am using SDKMAN to manage different versions of maven or java. SDKMAN is a tool for managing parallel versions of multiple Software Development Kits on most Unix based systems. It provides a convenient Command Line Interface (CLI) and API for installing, switching, removing and listing Candidates.
It is very convenient and this problem no longer exists for me.
Related
I have dependencies on several plugins in project. These dependencies are put in plugins directory during project build. Here is the example:
plugin 'com.company:some-plugin:1.0#msi'
plugin 'com.company:some-plugin:1.0#pkg'
Now it is time to upgrade plugin version but for some reason I want to keep version of plugin for Mac (pkg) unchanged:
plugin 'com.company:some-plugin:2.0#msi'
plugin 'com.company:some-plugin:1.0#pkg'
How can I do it? Regular force does not help. What I see now is that Gradle upgrades version of all dependencies without considering of extension.
P.S. I use Gradle 5.2
In previous version of Jenkins it was possible to install maven with auto installer. but from Jenkins 2.0 it seems to that feature is not provided. where is the place to auto install maven in Jenkins 2.0
You can see maven auto installation inside Manage Jenkins | Global Tool Configuration
Also you may need to install the maven plugin separately for building Maven project
I'm using os x and I've installed sbt with brew. After I've installed intellij and scala plugin for intellij it recognized .scala files of my project and suggested to import sbt project. When importing I saw that intellij is downloading sbt instead of using sbt installation that I have installed previously. How to force intellij to use sbt from brew? I don't want to clutter my ssd...
It is not a wise decision. sbt API changes slightly between versions. If intellij requires certain version for inner processing, it would be better to fulfil its expectations.
Set sbt.version in project/build.properties. IntelliJ respects the requested version. It won't download again if it has already been downloaded. You probably see this because the launcher you installed is a different version than what is installed in intellij. You can also set intellij to use the launcher you already have installed by changing the setting in preferences
the m2eclipse plugin is latest
the eclipse is the latest
the JDK is jdk7
the eclipse uses embedded maven version 3.xxx
I am keep getting this error “Error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher”
It seems that there are some problems running the embedded Maven.
Try installing a fresh Maven version, then click Preferences , Maven, Installationsand set the directory where you have installed Maven.
my envirement
eclipse version : 4.3 kepler
maven version : 3.2.x
OS : windows 7
m2e plugin version : 1.5
the problem caused by combination of things, e.g mismatch between maven installation and setting.xml is one, but mainly the problem was:
solution for my problem was to run the eclipse in administrator mode.
you can run maven embedded (comes with eclipse) or external installation
just to make sure they are pointing to the right setting.xml file
somehow the embedded disappears sometimes, just restart eclipse it will appear again
finally I can confirm the latest m2e 1.5 or above supports maven 3.
Note: set JAVA_HOME is a must, because maven uses it to look up java which runs maven itself
set non-embeded maven installation location in the windows path is needed
set M2_HOME was NOT needed in my case, thus to get m2e working in eclipse or interact maven though command line, M2_HOME is not needed
Is there a way to update the maven distribution without re-downloading the newer version and fixing the new path in the environment path?
something like: mvn selfupdate (the macport style)
No, but the Maven install is only a very thin bootstrap anyway.....
Maven downloads most of it's functionality as plugins. This normally happens when you run your first build and stores them in a local repository under:
$HOME/.m2/repository
So the good news is that when you install the new version of Maven, it will re-use the plugins already downloaded (unless newer ones are required).
Finally if you have concerns about performance it's an excellent idea to install a Maven repository manager. Software like Nexus can proxy and cache external repositories like Maven Central and will significantly improve your build performance (and enable off-line builds). Nexus is very lightweight, I run it on my laptop.