Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
501 views
in Technique[技术] by (71.8m points)

environment variables - windows 7 maven 2 install

I'm about to work through a book, "Flex on Java" and it's asked me to install maven 2+ i downloaded maven from the apache site. Added :

M2_HOME = C:apache-maven-2.2.1

and

M2 = %M2_HOME%in

to the environment vars according to the instructions at http://maven.apache.org/download.html then it gets to number 6 which says "In the same dialog, update/create the Path environment variable in the user variables and prepend the value %M2% to add Maven available in the command line."

Which environment variable should i edit and add %M2% to?

After googling i found a post which says "append", not prepend to the value of JAVA_HOME I've tried prepending and appending it to the java home var but when i try to do an mvn command from the command line it says its not recognised.

Never used maven before so this is my first set up. Can anyone see what i'm not doing right or what else i need to do to be able to use the mvn command, please and thank you.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The environment variable you should edit is path.

The route on Windows 7 is:

Control Panel -> System -> Advanced system settings -> Advanced Tab -> Environment Variables -> The path variable is right on the system variables area

The path variable specifies a group of directories and/or paths that Windows searches for commands definitions. You should append to the end of this variable value the value ;%M2% (note the semi-colon, different paths should be separated by them) in order for Windows to be able to find the Maven command definitions.

Appending ;%M2 at the end of the path environment variables is the same as appending ;C:apache-maven-2.2.1in

To test that everything is ok, type mvn --version, if everything is right then the current Maven version you're using should be displayed on the screen.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...