Reputation: 481
I have a maven project and I am importing it in Intellij IDEA. Everything is working fine except when i deploy the maven project console shows the following error
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project multisite: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]
This is my pom.xml file code
<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>multisite</groupId>
<artifactId>multisite</artifactId>
<version>1</version>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.4.2</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.5</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.14.4</version>
</dependency>
</dependencies>
Can someone tell me how to specify maven repository element path in my project or is there anything else i'm missing in pom.xml file ?
@ItachiUchiha: this is complete error i am getting in console now,
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building multisite 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- exec-maven-plugin:1.4.0:java (default-cli) @ multisite ---
[WARNING]
java.lang.ClassNotFoundException: src/multisite/Main
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:281)
at java.lang.Thread.run(Thread.java:745)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.144 s
[INFO] Finished at: 2015-10-30T16:57:08+05:00
[INFO] Final Memory: 10M/153M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.4.0:java (d
efault-cli) on project multisite: An exception occured while executing the Java
class. src/multisite/Main -> [Help 1]
Upvotes: 0
Views: 1149
Reputation: 36742
When you are trying to use mvn deploy
you need to specify the deployment location.
The deploy
command does the following :
copies the final package to the remote repository for sharing with other developers and projects.
It can be specified in the pom using the distributionManagement
tag like this:
<distributionManagement>
<repository>
<id>nexus-site</id>
<url>http://central_nexus/server</url>
</repository>
</distributionManagement>
For more information go through the docs on Distribution Management.
Upvotes: 1
Reputation: 32617
You have not specified a proper <distributionManagement/>
section.
You'll need something like this in your pom.xml
:
<distributionManagement>
<repository>
<id>releases</id>
<url>https://repository-server/releases</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>https://repository-server/snapshots</url>
</snapshotRepository>
</distributionManagement>
Apart from that, in your ~/.m2/settings.xml
file you will need to have the following section as well:
<servers>
<server>
<id>releases</id>
<username>username-goes-here</username>
<password>password-goes-here</password>
</server>
<server>
<id>releases</id>
<username>username-goes-here</username>
<password>password-goes-here</password>
</server>
Please, note that the <ìd/>
sections must match each other, as they are a mapping.
Upvotes: 1