0

How to execute maven commands with Spring STS manually?

I use Spring STS with build-in Maven using Linux. I need to add jar manually. I found that I need to do it by executing this command

mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.1.0 -Dpackaging=jar -Dfile=ojdbc14.jar -DgeneratePom=true

It is possible to do it through windows cmd. However, by using terminal in linux I receive output:

The program 'mvn' can be found in the following packages:
 * maven
 * maven2
Try: apt-get install <selected package>

I don't need install another Maven when Spring STS works with an internal Maven.

How to redirect terminal to use internal Maven in Spring STS ?

On the top of my head I think to edit MAVEN_HOME, but I am beginner and I prefer to ask you guys first.

Andrew_Dublin
  • 745
  • 6
  • 22
  • I think you can do Run As... On the makefile and configure it to suit your needs. That said, nothing wrong with a command line maven. – flup Nov 17 '13 at 14:41
  • Also, why not add the jar as a dependency? – flup Nov 17 '13 at 14:42
  • Aha! I understand it now. – flup Nov 17 '13 at 15:19
  • possible duplicate of [How to install jars in maven repository which is eclipse embedded?](http://stackoverflow.com/questions/4323981/how-to-install-jars-in-maven-repository-which-is-eclipse-embedded) – flup Nov 17 '13 at 15:19
  • @flup You won't find this oracle driver as a dependency in maven. You need to add it manually. – Andrew_Dublin Nov 17 '13 at 15:23

3 Answers3

0

I am not an expert but it seems that if you want to use maven from console you will have to install it on your OS.

Look at this: Where is mvn.exe when using embedded maven 3 in eclipse indigo?

Community
  • 1
  • 1
Pablo
  • 1,604
  • 16
  • 31
0

You can also run custom maven goal from within Spring STS by opening Run Configurations enter image description here

khyati patel
  • 13
  • 1
  • 9
0

your focus:
I don't need install another Maven when Spring STS works with an internal Maven.
but, in "STS", maven is not configured to work out of STS (and terminal usage is out of STS usage).
we have to install maven.

those who are here with "mvn" is not recognised like erros,
follow the following to setup maven to work from terminal.
maven download link is here

  1. 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):
  2. enter image description here

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:
3. enter image description here

4. enter image description here

5. enter image description here

6. enter image description here

now "mvn" command must work.


7. in my case, i use STS
and i had to restart STS (spring tool suit) for "mvn" to work in terminal in sts

sifr_dot_in
  • 3,153
  • 2
  • 33
  • 42