Am creating new java project using the pom.xml file. when i run the command mvn clean install am getting build failure error.
Can anyone please help me to resolve this issue.
and my pom.xml is like this
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com</groupId>
<artifactId>tasapitesting</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>tasapitesting</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.10</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
<wtpversion>1.8</wtpversion>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3.9</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Maven Central doesn't seem to have a 3.3.9 build for maven-compiler-plugin (see here). Regardless, the 3.3 generation is quite old. Unless you absolutely, positively have to use such an old version, just move forward to a newer version that actually exists, like 3.6.0, and you should be fine.
I have a multi module project where common-project is depend on another 3rdparty project and below is the pom.xml of common-project
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.tri.iss.pet.common</groupId>
<version>0.0.1-SNAPSHOT</version>
<artifactId>common-um-entities</artifactId>
<name>common-um-entities</name>
<description>Common UM Entities</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<fork>true</fork>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.tri.iss.pet.common</groupId>
<artifactId>3rdparty</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>jar</type>
</dependency>
</dependencies>
</project>
As you clearly check i have added dependency in pom.xml file but check below image its saying jar missing
Can someone tell me why only project dependency not able to load while other dependency which coming from Artifactory working fine ?
Note:- Dont be confuse from project name .
I'm setting up eclipse again to make plugins for bukkit, which is an API that i depend on. Also i want to move the .jar the build process creates to a directory of my choice.
http://wiki.bukkit.org/Plugin_Tutorial#Commands (makes the pom.xml below)
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>MY_PACKAGE_NAME</groupId>
<artifactId>MY_PLUGIN_NAME</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>bukkit-repo</id>
<url>http://repo.bukkit.org/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.7.9-R0.2</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Current output:
$project_root/target/MY_PLUGIN_NAME-0.0.1-SNAPSHOT.jar
Desired output:
C:/my/output/directory/MY_PLUGIN_NAME-0.0.1-SNAPSHOT.jar
You can use following configuration under <build> tag:
<outputDirectory>C:/my/output/directory</outputDirectory>
tip / warning : Although this will work but keeping your packaging outside target is discouraged. Its not maven standard. Rethink before doing it.
Given this complete Maven POM file that is meant to be used as a root POM for packaged (JAR, WAR, etc) projects or non packaged projects (for example web pages) that still should be tagged with a new release tag ...
<?xml version="1.0" encoding="ISO-8859-1"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<name>Common Maven parent POM</name>
<description>Maven parent POM for common POM properties for any type of project</description>
<url>http://my.site.com</url>
<groupId>com.my.site</groupId>
<artifactId>mvn-common</artifactId>
<version>0.12-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<eclipse.projectName>${project.name} ${project.version}</eclipse.projectName>
<mvn.local.repo.root>file:///C:/.m2</mvn.local.repo.root>
<scm.url.root>https://localhost/svn</scm.url.root>
<scm.url.project>workspace/tools/maven/pom/mvn-common</scm.url.project>
<scm.url.trunk>scm:svn:${scm.url.root}/${scm.url.project}/trunk</scm.url.trunk>
<scm.url.tag>${scm.url.root}/${scm.url.project}/tags</scm.url.tag>
<!-- Deploy makes only sense to packaged artifacts -->
<skip.deploy>true</skip.deploy>
</properties>
<scm><developerConnection>${scm.url.trunk}</developerConnection></scm>
<distributionManagement>
<repository>
<id>mvn.repo.releases</id>
<url>${mvn.local.repo.root}/releases</url>
</repository>
<snapshotRepository>
<id>mvn.repo.snapshots</id>
<url>${mvn.local.repo.root}/snapshots</url>
</snapshotRepository>
</distributionManagement>
<repositories>
<!-- These must also be defined in the local settings as <servers> -->
<repository>
<id>mvn.repo</id>
<url>${mvn.local.repo.root}/repo</url>
</repository>
<repository>
<id>mvn.repo.releases</id>
<url>${mvn.local.repo.root}/releases</url>
</repository>
<repository>
<id>mvn.repo.snapshots</id>
<url>${mvn.local.repo.root}/snapshots</url>
</repository>
</repositories>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<skip>${skip.deploy}</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<projectNameTemplate>${eclipse.projectName}</projectNameTemplate>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<tagBase>${scm.url.tag}</tagBase>
</configuration>
</plugin>
</plugins>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
<version>2.5</version>
</extension>
</extensions>
</build>
</project>
... can I not get the property true overridden on the command line when I execute
mvn release:prepare && mvn -Dskip.deploy=false release:perform
The property is used to set the configuration value for the maven-deploy-plugin to skip deploy as default (which should be overridden in a sub POM for packaged projects) and I believe that it should be possible to override a user defined property like this but not a Maven property which would be maven.deploy.skip in this case.
The release works fine in that it properly creates a new tagged version of the POM in the SVN repository but I can't get the maven-deploy-plugin to recognise the value for the property set on the command line
[INFO] [INFO] --- maven-deploy-plugin:2.8.1:deploy (default-deploy) # mvn-common ---
[INFO] [INFO] Skipping artifact deployment
[INFO] [INFO] ------------------------------------------------------------------------
Am I overlooking something here? A bug somewhere here could be an explanation but I have not found any reported that applies when I have searched around. It would be great if someone could see anything that looks incorrect or give me at tip on what to try next.
I eventually found the answer myself in Properties lost during Maven release:perform where the answer explained that there is a forked process for release so to get the command line property recognised and have it to override the property set in the POM must it be passed through as
-Darguments=-D...
and the command I must use then looks like this
mvn release:prepare && mvn release:perform -Darguments=-Dskip.deploy=false
Thanks to myself for answering this question and thanks Stephen Connolly that answered the other thread. It is just sad that I didn't find that answer until know in all the noise that come up when I try to google for it.
I would like to start Spark project in Eclipse using Maven.
I've installed m2eclipse and I have a working HelloWorld Java application in my Maven project.
I would like to use Spark framework and I'm following directions from the official site.
I've added Spark repository to my pom.xml:
<repository>
<id>Spark repository</id>
<url>http://www.sparkjava.com/nexus/content/repositories/spark/</url>
</repository>
And then the dependency:
<dependency>
<groupId>spark</groupId>
<artifactId>spark</artifactId>
<version>0.9.9.4-SNAPSHOT</version>
</dependency>
But I'm getting an error in Eclipse:
Missing artifact spark:spark:jar:0.9.9.4-SNAPSHOT
How can I resolve this issue? I don't want to download Spark's jar file and place in the local repository.
This is my pom.xml file:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.myproject</groupId>
<artifactId>Spark1</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Spark1</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repository>
<id>Spark repository</id>
<url>http://www.sparkjava.com/nexus/content/repositories/spark/</url>
</repository>
<dependencies>
<!-- (...) -->
<dependency>
<groupId>spark</groupId>
<artifactId>spark</artifactId>
<version>0.9.9.4-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Currently no repository is required to add for Spark library loading
You just need to add
<dependency>
<groupId>com.sparkjava</groupId>
<artifactId>spark-core</artifactId>
<version>2.6.0</version>
</dependency>
And that's it.
Useful tutorials to play with is here
The repository block needs to be wrapped in a repositories block:
<repositories>
<repository>
<id>Spark repository</id>
<url>http://www.sparkjava.com/nexus/content/repositories/spark/</url>
</repository>
</repositories>
Reason for failure is 0.9.9.4-SNAPSHOT is not available.Below is the list of the snapshots available. Use one among them based on your requirement.
0.9.8-SNAPSHOT/ Sat May 21 21:54:23 UTC 2011
0.9.9-SNAPSHOT/ Mon May 23 10:57:38 UTC 2011
0.9.9.1-SNAPSHOT/ Thu May 26 09:47:03 UTC 2011
0.9.9.3-SNAPSHOT/ Thu Sep 01 07:53:59 UTC 2011
Thanks,
Sankara Reddy
I had run into same issue because initially I started with different repository url for spark and then to use earlier version I changed the repository url. Some how it didn't seem to come into effect until I changed the repository id. Try changing the repository id.
Could be bug in maven because running maven from console also couldn't resolve the dependency without updating the id.
please add the repository , tag inside the repositories tag like below
<repositories>
<repository>
<id>Spark repository</id>
<url>http://www.sparkjava.com/nexus/content/repositories/spark/</url>
</repository>
</repositories>
The last versions (2.1 and later) of Spark only need the dependency defined inside the pom.xml file
<dependency>
<groupId>com.sparkjava</groupId>
<artifactId>spark-core</artifactId>
<version>2.1</version>
</dependency>
the repository definition is not longer required
use this latest repository.
http://mvnrepository.com/artifact/org.apache.spark/spark-core_2.10/1.6.0
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.10</artifactId>
<version>1.6.0</version>
</dependency>
use this, and also make sure you change spark library to version 2.11.x in eclipse project build path
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.spark-scala</groupId>
<artifactId>spark-scala</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>${project.artifactId}</name>
<description>Spark in Scala</description>
<inceptionYear>2010</inceptionYear>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<encoding>UTF-8</encoding>
<scala.tools.version>2.10</scala.tools.version>
<!-- Put the Scala version of the cluster -->
<scala.version>2.10.4</scala.version>
</properties>
<!-- repository to add org.apache.spark -->
<repositories>
<repository>
<id>cloudera-repo-releases</id>
<url>https://repository.cloudera.com/artifactory/repo/</url>
</repository>
</repositories>
<build>
<sourceDirectory>src/main/scala</sourceDirectory>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<plugins>
<plugin>
<!-- see http://davidb.github.com/scala-maven-plugin -->
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.2.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.13</version>
<configuration>
<useFile>false</useFile>
<disableXmlReport>true</disableXmlReport>
<includes>
<include>**/*Test.*</include>
<include>**/*Suite.*</include>
</includes>
</configuration>
</plugin>
<!-- "package" command plugin -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>1.2.1</version>
</dependency>
</dependencies>
</project>