Not able to install Maven on Linux - linux

I am trying to install Maven on Linux as I have extracted tar file also in my directory where I wanted to and also setup the environment variables but when I check mvn --version then it complains mvn:command not found.
Can anybody tell me reason.

All of these variables you should set in .bashrc or corresponding file. This way you will have them set for each bash/terminal/shell opened. Try also to go into $M2_HOME/bin directory and run the maven from there. ./mvn --version

Related

Could not create maven project in eclipse IDE(oxygen)

click here to see the image
i could not create maven project in eclipse IDE.
i am getting the error in the image and as well as mentioned below
Could not calculate build plan: Plugin
org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its
dependencies could not be resolved: Failed to read artifact descriptor
for org.apache.maven.plugins:maven-resources-plugin:jar:2.6 Plugin
org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its
dependencies could not be resolved: Failed to read artifact descriptor
for org.apache.maven.plugins:maven-resources-plugin:jar:2.6**
i have tried following:
deleted the folders and files under .m2/repositary and it did not work
windows->preferences->maven->user settings->and pointed the settings.xml to the downloaded apache maven 3.5.2 and it also did not work.
created the settings.xml under .m2/repositary ,it also did not work.
environment variable also set for maven(maven_home and m2_home) and java_home.
i have googled and tried all these but could not resolve this issue.
any help would be appreciated .
Thanks in advance.
First, make sure to use .m2/repository, not .m2/repositary
Check that your settings.xml is correctly set, with at least:
<mirror>
<id>Central</id>
<url>http://repo1.maven.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
Then check in a CMD (meaning outside) Eclipse, if:
M2_HOME and JAVA_HOME are also correctly set there
java -version does return the expected version
mvn -version does return the expected version
you can download the artifact:
For the last point, you actually can execute a mvn command, anywhere you want (no need for a pom.xml)
cd c:\
mvn org.apache.maven.plugins:maven-dependency-plugin:3.0.2:get -Dartifact=org.apache.maven.plugins:maven-resources-plugin:2.6 -U

Spark Installation Problems

I am following instructions from here:
https://www.datacamp.com/community/tutorials/apache-spark-python#gs.WEktovg
I downloaded and prebuilt version of Spark , untarred it and mv it to /usr/local/spark.
According to this, this is all I should have to do.
Unfortunately, I can run the interactive shell as it cant find the file.
When i run :
./bin/pyspark
I get
-bash: ./bin/pyspark: No such file or directory.
I also notice that installing it this way does not add it to the bin directory.
Is this tutorial wrong or am I missing a trick?
You need to change your working directory to /usr/local/spark. Then this command will work.
And also, when you untar it, it usually will not add it to bin folder. You need to add it manually by adding the path to environment variables.
Update your working Directory to /usr/local/spark and execute the command. Hopefully this will fix the issue.

Cargo path setup for rust-racer

I just installed racer using cargo. After installing it say this:
Installing /home/karthik/.cargo/bin/racer
warning: be sure to add `/home/karthik/.cargo/bin` to your PATH to be able to run the installed binaries
How do I do this? Googling didn't help. Also, Should I be setting a PATH variable for cargo bin as well?
Edit: OS is Ubuntu 14.04 and I have super user access
You have to add the cargo bin path to your PATH variable and set the RUST_SRC_PATH in .profile or .bash_profile.
Related unix.stackechange question
There are two steps:
(1) Add the Cargo bin to your PATH variable. You can run $ whereis cargo to find the bin path, and then do $ sudo -H gedit /etc/environment where you can add that new path section to your current PATH variable. You will need to save and close the file (and you can ignore the error message in the terminal during the saving portion) in order for it to take effect.
(2) Run $ rustup component add rust-src to download the necessary Rust source files for you.
At this point Racer should work properly.
This is based on the answer here.

Overriding System Binaries With Home Directory Binaries

I'm trying to compile a piece of software in my home directory (OpenMPI). One of the build dependencies (autoconf) installed on my system is not the newer version asked for by the OpenMPI autogen script. I compiled and installed the newer version of autoconf in my home directory.
Is there anyway for the binary installed in my home directory to "override" the version installed on the system for my session?
I tried setting an alias which works via command line but not for the script used to generate the configure script.
Add the path to the binary you want to override to your $PATH environment variable.
Like PATH=/path/to/binary:$PATH ./compile
Your added path will then be looked up first when trying to find the compile command. It will only be valid for that execution and will not remain after command has returned. You can use export PATH=/path/to/binary/:$PATH and it will be saved for that session.
EDIT: As Eric.J states, you can use which compile which will output the path to the command, just to make sure it's the right one.
You can change the PATH environment variable so that your home directory appears before the system directory, e.g.
PATH=$HOME/bin:$PATH
You can then use the which command to ensure the correct binary is being picked up.

update Apache Ant on CentOS

I need to update Apache Ant on my server.
I downloaded the newest Ant, built it, and (I thought) installed it. But when when I check it says the old version is still installed.
How do I update/replace the previous version of Apache Ant on a CentOS 5.? server?
take care,
lee
As mentioned it's probably getting picked up in your path. Post the output from echo $PATH
To configure your CentOS after installing a new version of Apache Ant, proceed to the following steps:
Locate the directory where the new Ant is located
Set the ANT_HOME environment variable to this directory
Add $ANT_HOME/bin to your PATH
P.S. To modify environment variables, you may edit the /etc/environment file, and reboot, or modify your local .bashrc. Look at your current environment variables by analyzing the output of printenv, e.g., to see the current value of PATH and then add the Ant path to it, e.g.
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/adoptopenjdk-8-hotspot-amd64/bin:/usr/local/ant/bin

Resources