How to check maven installed in Drools machine - maven

I have installed Drools in my machine and we have m2 repository in our linux machine. Does that mean maven installed in my machine.
If type mvn -v its saying command not found.
I am new to this maven. Kindly help me out

Drools is a library. It does not "install". You add it as a dependency to a Java project. If you "installed" something, it's not Drools. Perhaps it's jBPM or some other application which uses Drools.
Maven is a toolchain. When you install it, the zip file includes a binary that you need to put on your path. That binary (mvn) allows you to run from the commandline.
The two are not related in any way.
If you get an error when trying to run mvn -v that the command is not recognized, that means that the Maven binary is not on your path. Find where you installed Maven, locate the 'bin' directory in that installation, and add that bin directory to your Path environment variable.
If you did not install Maven, and therefore don't have an install directory, you probably want to go do that. Don't forget to put the bin directory on your path after installing.
(A less common way of using Maven involves packaging a mvn.cmd or mvn.sh script with your project itself so that you don't need to have Maven installed globally. If this is what you're doing instead, you need to run the mvn command from the same directory as that script.)

Related

how to use mvnw command for first project setting

I am new to maven and have some basical questions.
When I see some projects, there is mvnw file included.
What I know is I dont need to install maven on my local if I use mvnw.
My question is:
what will happen when I firstly execute mvnw install?
maven with certain version is automatically installed on my local?
can I use like mvn compile instead of mvnw compile after executing mvnw install?
Thanks in advance.
what will happen when I firstly execute mvnw install? maven with certain version is automatically installed on my local?
The mvnw command will look for maven-wrapper.jar in the .mvn/wrapper directory. It will automatically download this jar file if it is not present there. We can consider this step as installing maven in the local machine just for this project. And the version of maven-wrapper.jar installed depends on the configuration in the mvnw command. On the other hand, if the maven-wrapper.jar is already present in the ./mvn/wrapper directory, the mvnw command simply uses it.
can I use like mvn compile instead of mvnw compile after executing mvnw install?
If you have maven installed in your local machine, you certainly can use mvn compile instead of mvnw compile, as long as the version of maven installed in the local machine is compatible with the project. However this can cause problems if the maven installed in the local machine is an older version and the project requires a newer version, or the the other way around.

IntelliJ cannot find Maven M2_HOME environment variable

I'm trying to make my first step with Maven system. But I cannot understand if I should install it separately or if it comes built-in with IntelliJ 13 Community Edition? My system is Windows 7.
Maven does not come bundled with Intellij. You need to install the version of Maven you'd like to use on your computer.
Intellij has a Maven plugin, which requires that you either set M2_HOME or supply it with the location of your Maven install.
First you should it install it separately cause you will need it on command line. Furthermore it's best to understand maven on command line first and than make the integration step into Maven with an IDE of your choice.

maven doesnt seem to be installing with springsource tool suite

I recently installed the springsource tool suite plugin for eclipse, running on windows 7. But when I open a command prompt (by typing cmd in the windows start menu) and type in:
mvn --version
I get the following response:
'mvn' is not recognized as an internal or external command, operable program, or batch file.
So I then downloaded the stand-alone version of springsource tool suite, which is not what I want. And nonetheless, I still get the same response on the command line when I type in mvn --version. Can anyone tell me how to fix this problem?
I get the same response when I type in java -version . So this might be a command prompt problem. I a following the exact syntax from web tutorials.
EDIT:
I just tried to download m2e in the eclipse marketplace, but got the message that there is nothing new to install. This seems to indicate that I have maven installed, so then how do I access it via the command line in windows 7?
You have to configure your Maven environment variable to be able to use it in the command prompt.
In your case there's no need to download the maven binars because it comes with STS, just find the Maven folder inside the STS directory.
"___" is not recognized as an internal or external command
is shown when program is not installed or the path of that program is not set (to execute from other path).
remember, in "STS", maven is not configured to work out of STS (and terminal usage is out of STS usage).
we have to install it.
maven download link is here
download latest maven from here
extract it where ever you want.
i extracted as below (see the bin,boot,conf,... folders are shown below as in the image):
as this maven download is extracted from zip file (it is not setup), you will have to add this extracted path to "PATH" variable in windows environment.
follow this to set environment path:
now "mvn" command must work.
but
in my case i had to restart STS (spring tool suit) for this to work

Maven location (when installed indirectly with Netbeans/Glassfish)?

Where is the maven home directory when you install Netbeans with Glassfish? I have searched for 'mvn' in the Program Files directory and my user directory in Windows 7 but it turns up nothing.
In the Maven settings in Netbeans for 'Maven Home' it says 'Bundled' which isn't much use to me, I need the actual path to maven.
First install maven separately (and verify it by running mvn command line) and then open netbeans and navigate to Tools -> Options -> Java -> Maven (I guess you already know that but just in case) and change the 'Maven Home' path to the directory where maven is installed.
The Bundled maven could generally be found at NetBeans_install_directory/java/maven.
Example For Mac:
/Applications/NetBeans 8.2.app/Contents/Resources/NetBeans/java/maven/
Example For Windows:
C:/Program Files/Netbeans 8.2/java/maven/
Not sure what version you downloaded back then, but with version 7.3, maven is found here:
C:\Program Files (x86)\NetBeans 7.3\java\maven\
In Mac OS it is in
/Applications/NetBeans/NetBeans 8.0.2.app/Contents/Resources/NetBeans/java/maven/bin
I know its an old question but still there's also another way of seeing where mvn is installed on your Netbeans.
When you clean and build your project you can see in the console output the location of maven used. See the red circle in the screenshot /home/<user>/netbeans-8.2/java/maven/bin/mvn
The maven bundled with NetBeans located at
% NetBeans Installation Location %\java\maven
Eg: C:\Program Files\NetBeans 8.2\java\maven\bin

How to deploy own files from maven

I am installing and running sakai project from command prompt
mvn install sakai:deploy
but command prompt show me error that 2 artifact missing that is 2 jar files are missing dwnload it manually
i am dwnload it and save it in local system then how i can install and deploy it
When you build Sakai it will generate that missing jar file and place it into the local maven repo. That said, this version of Sakai is very old and you should be running Sakai 10. We suggest you upgrade to Sakai 10 and maven 3. If you do, this issue will go away.
The process for building Sakai is as follows:
Open a command line shell
Change directory to your Sakai source root directory (should contain many directories including the "master" directory)
Execute mvn clean install to build the Sakai source using maven
Note: The build will take an extra 5-10 minutes to download dependencies the first time
Execute mvn sakai:deploy to deploy Sakai to your tomcat using maven
Partial builds are supported by the maven2/3 build system
You can do a "mvn clean install sakai:deploy" from any subdirectory and build just that code
Once you have downloaded the jars you can run maven off-line with mvn -o clean install sakai:deploy
As i can understand you have to manually add the jar in .m2 repository where it needs to be or
add dependency in pom.xml for it(it will automatically add it in repository).
One more thing you can try, go to project>right click>build path> add external jar (it will add the jar to your project).

Resources