Maven re-build and deploy - maven

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

Related

Can you modify files in a repository right after issuing maven compile install?

For projects which take a long time to build, can you issue the maven compile or maven install commands and then continue making changes to the files in your repository, without these changes affecting the outcome of the maven install command?
Is a snapshot automatically taken when the command is issued? If not, is there a way to request that maven take a snapshot of the project when a command is issued, so that you could continue making changes after that snapshot?
If you build locally, you should not be changing files while you build because you might break the build.
If you build on a build server, it depends:
If you run a clean package or clean install, then there is just one checkout at the beginning. After that it should not be a problem to make further commits.
If you build a release with Maven release plugin, you should probably be more careful. I haven't actually seen any problems in nature yet, but since the Maven release plugin commits to git/svn itself, you might cause problems when committing during the build on the same branch.

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 (Maven) build vs clean and build vs build with dependencies

It might be a stupid question, but I'm new to maven. My question is simple: what happens exactly when using build, clean and build, and build with dependencies? and when to use each one?

Making sure maven is running from scratch with a clean repo

I am pretty new to Maven and really not trying to fully learn it right now, just trying to install my java project.
I get some errors (it is from a Hadoop Crunch project) but the errors feel like they are referring to my older code that was doing a division and could be div by zero.
So anyway: Currrently I am dong mvn clean install but looks like there is something its cache still? is there a more powerful way of doing this such that I make sure nothing is coming from its cache, etc?
Look for your repo at C:\Users\youruser\.m2 or ~/.m2, you can delete that whenever you want but it will cause a "Download the Internet" the next time you do something.
That's obviously not the solution for daily use, the mvn clean install does compile and put the binaries of your project in your local repository from scratch, but if you have SNAPSHOT dependencies to separate projects (I'm not talking about submodules, I mean projects in some other directory) then you would need to go to those projects first and do mvn clean install there first so that your local repository has the latest binaries.

Save changes resources before running maven install through m2eclipse

I am using m2eclipse and was wondering if there is a way to make it save all the sources when running maven install. I need to do it manually each time and sometimes forget to...
Thanks

Resources