1

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>
7
  • can you run the command with -X flag Commented Apr 7, 2016 at 13:01
  • also do a project> clean and then run the command with -X (for verbose logging) Commented Apr 7, 2016 at 13:03
  • check this similar question stackoverflow.com/questions/5910037/… Commented Apr 7, 2016 at 13:04
  • 1
    DistributionManagement is not part of repositories maven.apache.org/pom.html#Distribution_Management Commented Apr 7, 2016 at 13:46
  • 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] Commented Apr 7, 2016 at 21:22

2 Answers 2

1

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>
Sign up to request clarification or add additional context in comments.

Comments

0

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>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.