Could not create maven project in eclipse IDE(oxygen) - m2eclipse

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

Related

Spark for Kubernetes Test on Mac

Trying to build the image from the provided download. Used "Source Code" package option download, not Hadoop versions. Following spark.apache.org/docs/2.3.0/running-on-kubernetes.html#docker-images first step to build a docker image. Have Docker CE with K8s running on Mac.
Using Terminal: Ran in spark folder:
./bin/docker-image-tool.sh -r cloud.docker.com/xxxx/spark build
All runs until here:
Step 5/14 : COPY ${spark_jars} /opt/spark/jars
COPY failed: stat /var/lib/docker/tmp/docker-builder840552377/assembly/target/scala-2.12/jars: no such file or directory
Please assist a newbie! Not sure where this folder structure is or whats up.
Please don't assume I did something correct....I could have missed an obvious install before running this. Help is appreciated after you laugh. :-)
Thanks
Make sure you've cloned the right spark project and then Build spark with this command
./build/mvn -Pkubernetes -DskipTests clean package
If you just need to solve your current error, use this command (-pl is used to build a specified module where spark-assembly_2.11 is the artifactId as defined in assembly/pom.xml file.)
build/mvn -pl :spark-assembly_2.11 clean install
The scala jar will be available in the Assembly module folder.

Not able to install Maven on 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

mvn dependency:get -Ddest parameter in Linux

I´m using the mvn dependency:get to download some specific *.jar (latest Release Version) files on Linux Ubuntu.
I am using the following command:
mvn dependency:get -Dartifact=org.apache.httpcomponents:httpmime:RELEASE:jar -DrepoUrl=https://repo1.maven.org/maven2 -Ddest=/home/dev/workspace/"
The artifact is downloaded as expected, but only to the local maven repository and not to copied to the specified Location. I have also tried using
-Ddest=home/dev/workspace/
-Ddest=/home/dev/workspace
But there is no difference in the Result.
I know there is the possibility to use dependency:copy, but therefore i would need a pom.xml (which i don´t want to create only for the copy command).
Thanks for your help
I have given an examples. Please check.
mvn dependency:get -Dartifact=org.apache.maven:maven-core:2.2.1:jar:sources -DremoteRepositories=http://repo1.maven.apache.org/maven2 -Ddest=/home/dev/workspace/something.jar
You can also use dependency:copy as
Artifacts can also be resolved by specifying the classifier and optionally type. Type is only used with the classifier and defaults to java-sources. When the classifier is set, the list of dependencies is used as the base to resolve artifacts with the classifier and type.
For example:
mvn dependency:copy-dependencies -Dclassifier=sources
will try to find the sources for all dependencies and copy them.
For more data command line like:
mvn dependency:copy-dependencies [optional params]
Resource Link:
http://maven.apache.org/plugins/maven-dependency-plugin/usage.html
https://maven.apache.org/plugins/maven-dependency-plugin/copy-dependencies-mojo.html
UPDATE:
use "-Ddest=path/to/my.jar"; otherwise, it is just copied to your local ~/.m2/repository (makes it look like nothing happened).
See http://maven.apache.org/plugins/maven-dependency-plugin/get-mojo.html#destination
example=>
mvn org.apache.maven.plugins:maven-dependency-plugin:2.5.1:get
-DremoteRepositories=repo.maven.apache.org
-Dartifact=org.apache.ant:ant:1.8.1
-Ddest=ant-1.8.1.jar
(result: ant-1.8.1.jar in current directory)

Linux : How to add a Dir location as one the argument in SSHEXEC command

Im using a MAVEN commands in my ANT scripst in the Linux mechine ,
here is my ant script which calls maven.sh file to clean and install
sshexec host="**" username="" password="" .... command="/var/-----/mavenBuild.sh/"/>
mavenBuild.sh has : MVN clean install with all the required classpath and maven path loaded in it
but the problem is I have to run this mavenBuild.sh under a specific dircetory where the POM.xml is located , since i am not mentioning the path of my POM.xml file in the SSHEXEC , the installation is not failling with an error as no pom file exist, IF i run this mavenBuild.sh file manually under by to the location its woring fine . Kindly please help how can i append this location(Directory location of my pom ) in the SSHEXEC as one of the argumensts
Maven supports the "-f " parameter.
So if you include this parameter in your commandline in mavenBuild.sh, it will work without changing directories
mvn -f <path to pom> <goals>
This isn't a very technical solution and I haven't used SSHEXEC or Maven but couldn't you add a the following to the top of the mavenBuild.sh file?
PATHTOXML=/path/to/xml
cd $PATHTOXML
or even shorter:
cd /path/to/xml
You could also pass it as a variable to the mavenBuild.sh if the directory changes.
Moving to the SSHEXEC have you looked at this post, it maybe helpful:
Variables in bash script in sshexec from ant
Edit - I can't comment yet :(
Edit again -> I had a thought, i've read you cannot cd with SSHEXEC so is it worth considering putting the commands in another "install.sh" file and using scp to the remove machine and then SSHEXEC commandresource to execute it

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