1
votes

I have a very simple / basic Web app. When I run

mvn deploy -e

I am seeing the following error in the console.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project TestWebApp: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project TestWebApp: Deployment failed: reposi tory element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)

Maven section is:

<profile>
        <id>TestWebApp-Repo</id>
            <repositories>
                <distributionManagement>
                    <repository>
                      <id>TestWebApp_Repository</id>
                      <name>TestWebApp Applications Repository Internal</name>
                      <url>C:/Users/~/.m2/repository</url>
                      <releases>
                        <enabled>true</enabled>
                      </releases>
                      <snapshots>
                        <enabled>false</enabled>
                      </snapshots>
                    </repository>
                </distributionManagement>
            </repositories>
</profile>
2
can you run the command with -X flag - Praveen Kumar
also do a project> clean and then run the command with -X (for verbose logging) - Praveen Kumar
DistributionManagement is not part of repositories maven.apache.org/pom.html#Distribution_Management - khmarbaise
I am seeing the following error when I ran with -X flag: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project TestWebApp: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1] - ThomasKA

2 Answers

1
votes

I resolved this issue by moving distributionManagement into the pom file and changing the url to use file. The link http://maven.apache.org/wagon/index.html is very helpful. My solution is below:

<distributionManagement>
    <repository>
      <uniqueVersion>false</uniqueVersion>
      <id>TestWebApp_Repository</id>
      <name>TestWebApp Applications Repository Internal</name>
      <url>file://C:/Users/user/.m2/repository</url>
      <layout>default</layout>
    </repository>
    <snapshotRepository>
      <uniqueVersion>false</uniqueVersion>
      <id>TestWebApp_Repository</id>
      <name>TestWebApp Applications Repository Internal</name>
      <url>file://C:/Users/user/.m2/repository</url>
      <layout>default</layout>
    </snapshotRepository>
  </distributionManagement>
0
votes

Try to activate the profile TestWebApp-Repo:

mvn -e -PTestWebApp-Repo deploy

Or insert this snippet at the end of <profile>:

    <activation>
          <activeByDefault>true</activeByDefault>
    </activation>