Maven tool of Java, how to using mvn uninstall package? - maven

Java, mvn tool, how to using mvn uninstall package? Have some plugin, tool, shell script and command method?

If you want to uninstall/remove any artifact downloaded by maven just go to your ~/.m2/repository directory, where all installed artifacts are stored and delete that one which you want to get rid of.

All you have to do is remove the dependency from your pom.xml, maven should take care of the rest.
I really struggled with this because I had an upstream dependency that included the dependency I was trying to remove, so even mvn dependency:purge-local-repository didn't help - in that case, it might be worth trying to configure dependency exclusions (also in the pom.xml file).

Related

Can't determine why maven is downloading a jar file

I am having an issue with log4j-api. I have specified log4j-api:2.8.1 in my pom but when running a mvn clean install command, mvn keeps insisting that I need log4j-api:2.1. If i delete the log4j-api:2.1 directory from my .m2/repository and do the mvn clean install command, it will say it is downloading the 2.1 version.
Here's the weird thing: If I do a mvn dependency:tree there is no mention of version 2.1, only 2.8.1.
Anybody understand why mvn dependency:tree would say my project is NOT dependent on version 2.1 but then downloads the 2.1 version when I run mvn clean install?
Some other versions we are using in case somebody knows that something could be causing this:
Spring Boot 1.2.1
Spring Framework 4.1.6
Elastic Java APIs 5.6.4
Get the dependency tree in verbose mode
mvn dependency:tree -Dverbose
From maven docs
More specifically, in verbose mode the dependency tree shows dependencies that were omitted for: being a duplicate of another; conflicting with another's version and/or scope; and introducing a cycle into the dependency tree.

whats the purpose of installing maven on MAC

when I search for installing maven, I found videos on how to instal maven on eclipse and how to instal maven on MAc.It may be very basic question but just wondering whats the purpose of installing maven on MAC? I use maven on eclipse already
You would install Maven to be able to execute the mvn command from the command line (usually Terminal.app). This is usually because you need to do things that your IDE does not easily allow you to do, or to ensure that your project builds correctly with plain Maven.
This is important because the Maven emulation in Eclipse is good but not perfect (as there are some design decisions in Eclipse that do not work well with the Maven mindset). A typical situation is that Eclipse does not treat src/test different from src/main and Maven does. The easiest way to ensure this, is to build your projects from the command line once in a while.

Netbeans - one maven project as denepdency for another

I have two maven projects in Netbeans. How can I add one as dependency for another?
In Intellij IDEA I can just add <dependency> and it works fine. But Netbeans can't resolve this dependency this way.
You should be able to do so, in Netbeans. Just make sure to have the project, you want to use as dependency, is built into your maven-local-repo by executing a maven-install.
I don't know how it works in Netbeans, but in Eclipse you can just Rightclick -> Run as-> Maven Install to install your project.
Maybe in Netbeans, you have to use the Maven-cmd-tool. Just navigate to the location in your project, where your pom.xml is, and run mvn install. That should install your project into your maven-local-repo. After that, just run mvn clean install -U in your other project, which uses the previously built project as dependency, and it should recognize the dependency.

Install m2e in eclipse without install maven in system

I recently try to use maven in my eclipse project. In maven official website there are several step that I must to accomplish to configure maven side by side with eclipse. But I know there is a m2eclipse plugins if I need to use maven. But I don't know if I can use this plugins with maven installed in system or not.
So can I use this plugins without maven been installed in system or not ?
The m2e plugin brings a copy of Maven 3.0.4 and installs it inside of Eclipse so the plugin can use it. This is enough to build Maven projects inside of Eclipse. No external installation is needed.
You must start Eclipse with a JDK, though. A JRE isn't enough. If you're unsure: Look for the file lib/tools.jar. When it's there: You're good.
This copy isn't accessible from the command line. If you want to build from the command line as well or if you need a newer version of Maven than 3.0, you need to install Maven and configure the plugin accordingly.

Maven re-build and deploy

I'm new to compiled web development, and I'm just trying to figure out the build/deploy process.... I've done:
mvn clean install
on a project, which built and deployed the project and now I can see it. If I want to make changes to the codebase, do I really need to run mvn clean install again to re-build and deploy the changes or is there a way to do a quicker build without using a "proper" IDE?
I'm using vim/gvim
Thanks!
Maven already handles the dependencies and only re-builds the necessary files... unless you throw away all previous build artifacts with clean! You should only need to use clean when you run into problems, or when you have checked out a different version from version control. Usually, mvn install should suffice.
You can integrate that with Vim; the simplest is to
:set makeprg=mvn
and then trigger a build with :make install.
Plugins build on that simplistic setup, e.g. check out:
maven-plugin
maven-ide

Resources