Kannan C
Kannan C

Reputation: 93

Can I use Maven without setting the Environment variable?

I want to use Maven for my project.

In my office computer , I don't have the Admin privilege . Hence I am not able to set the "System Variable". I have access only to "User Variable" where I can set only the Java_Home.

Can I use Maven without adding the M2_Home and editing the Path variable ?

Upvotes: 3

Views: 15199

Answers (5)

MyTwoCents
MyTwoCents

Reputation: 7622

We can add .bat file and link it to cmd by default so whenever you open the terminal that code will execute and set your variable

You can refer more in detail here.

Update:

For Windows 10 user can add detail for your account and doesn't require admin access. Search for below text in windows search bar

Edit Environment variables for your Account

Upvotes: 0

Anvita Shukla
Anvita Shukla

Reputation: 449

If you don't have admin rights, simply set the path till Maven's bin in lets say MAVEN_HOME in user variables. MAVEN_HOME

Then go to the Path variable in user variables and add MAVEN_HOME to it. enter image description here

You are all set then, just go to command prompt and type mvn -version and you should be good with maven setup in your system.

Upvotes: 1

fdam
fdam

Reputation: 830

You could set the M2_HOME user variable even you are not an administrator, and the variable path is unnecessary, you could easily do the same task referencing the maven fullpath bin directory.

Upvotes: 1

Volodymyr Demenkov
Volodymyr Demenkov

Reputation: 197

Sure you can, you just need to build your project from maven home actualy

Here is an example from stackoverflow

Upvotes: 0

Haythem ROUIS
Haythem ROUIS

Reputation: 357

It depends if you are using it inside an ide or building project from terminal.

  • If you are using an IDE, there is probably an embedded maven ( there is one inside Eclipse and Intellij IDEA)
  • If you are building using CLI you can invoke maven using the full path for instance :

    /home/<your_folder>/tools/apache-maven-3.5.0/bin/mvn clean install from your project path

Upvotes: 3

Related Questions