My pom file looks like this :
<distributionManagement>
<repository>
<id>maven-s3-release-repo</id>
<name>S3 Release Repository</name>
<!-- http://bigpetstore.s3.amazonaws.com/maven/ -->
<url>s3://bigpetstore/maven</url>
</repository>
</distributionManagement>
When I run , "mvn deploy", I get my project published to the correct repository.
However, if I run "release:prepare" followed by "release:perform", I get the following error:
[INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-
plugin:2.7:deploy (default-deploy) on project BigPetStorePro: Deployment failed:
repository element was not specified in the POM inside distributionManagement element or
in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]
So, my question is: Why is it that "mvn deploy" is able to easily deploy my contents, however, mvn release:prepare fails to see the contents of the distributionManagement?
Clearly, the tag is present.
Related
I'm trying to share some code between two projects by loading it as a dependency via maven. For some reason, I can't get Maven to pick up the dependency.
Here's how I generated the shared JAR:
mvn install:install-file -Dfile=/Users/usr1/shared-code-1.0.0.jar -DpomFile=/Users/usr1/shared-code/pom.xml -DlocalRepositoryPath=.
This jar is held in a git repo github.com/myOrg/myRepo/repository where repository is the branch. The configuration described in the pom file for the shared code looks like this:
<groupId>com.myOrg</groupId>
<artifactId>shared-code</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
Here's how I defined the dependency and repository in my other code bases:
<dependency>
<groupId>com.myOrg</groupId>
<artifactId>shared-code</artifactId>
<version>1.0.0</version>
</dependency>
...
...
<repository>
<id>shared-code/id>
<name>Shared code for my stuff</name>
<url>http://raw.github.com/myOrg/myRepo/repository</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>\
The exact error I'm getting when I try and do a mvn clean package is:
[ERROR] Failed to execute goal on project otherCodeBase: Could not resolve dependencies for project otherCode:myProject:jar:latest: Failure to find com.myOrg:shared-code:jar:1.0.0 in http://[company's artifactory repo] was cached in the local repository, resolution will not be reattempted until the update interval of artifactory has elapsed or updates are forced -> [Help 1]
At first glance, it looks like Maven isn't even scanning the repository I defined in my other code's pom file, but when I execute mvn help:effective-pom it does appear. I should also add that I did make this repository public for the sake of getting it to work once. What gives?
I am running Maven 3.5 on Windows 10. Set two repositories in .m2/settings.xml
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>maven-release</name>
<url>https://artifacts.repo.openearth.community/artifactory/distarch-maven-staging</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>maven-snapshots</name>
<url>https://artifacts.repo.openearth.community/artifactory/distarch-maven-snapshots</url>
</repository>
</repositories>
Now I need to create a project from a custom quickstart archetype which was published in maven-release repo.
mvn archetype:generate -DarchetypeGroupId=com.lgc.dist -DarchetypeArtifactId=com.lgc.dist.core.msp.quickstart -DarchetypeVersion=0.1 -DinteractiveMode=false -DgroupId=com.foo -DartifactId=com.foo.example.firstservice -Dversion=1.0-SNAPSHOT -DserviceName=FirstService -Dpackage=com.foo.example.firstservice
The quickstart artifact com.lgc.dist.core.msp.quickstart is available at https://artifacts.repo.openearth.community/artifactory/distarch-maven-staging/com/lgc/dist/com.lgc.dist.core.base.pom/0.1/com.lgc.dist.core.base.pom-0.1.pom. Same goes for jar.
However the output of the mvn command shows it is trying to download from apache.org maven repository which was not defined anywhere in settings.xml file
[INFO] Generating project in Batch mode
[WARNING] Archetype not found in any catalog. Falling back to central repository.
[WARNING] Add a repsoitory with id 'archetype' in your settings.xml if archetype's repository is elsewhere.
Downloading: https://repo.maven.apache.org/maven2/com/lgc/dist/com.lgc.dist.core.msp.quickstart/0.1/com.lgc.dist.core.msp.quickstart-0.1.pom
[WARNING] The POM for com.lgc.dist:com.lgc.dist.core.msp.quickstart:jar:0.1 is missing, no dependency information available
Downloading: https://repo.maven.apache.org/maven2/com/lgc/dist/com.lgc.dist.core.msp.quickstart/0.1/com.lgc.dist.core.msp.quickstart-0.1.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.488 s
[INFO] Finished at: 2017-08-03T21:46:38-05:00
[INFO] Final Memory: 15M/170M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.0.1:generate (default-cli) on project standalone-pom: The desired archetype does not exist (com.lgc.dist:com.lgc.dist.core.msp.quickstart:0.1) -> [Help 1]
I ran mvn -X to check which settings file it is using and it shows it was .m2/settings.xml. Why is it not working? Is there any special setup for windows 10? The same command works on a Linux VM with the same settings.
For some reason the archetypes weren't found in the repositories or the repositories could not be contacted then it says:
Archetype not found in any catalog. Falling back to central repository.
You can avoid this behaviour if you set your repositories as mirrors.
because of security reasons, in the maven 3.x version, maven-archetype-plugin 3.x is not possible to particular repository from command line argument. you can refer this link http://maven.apache.org/archetype/maven-archetype-plugin/archetype-repository.html. you can use look below version
I am trying to deploy a CAR file to a ESB instance. I am following the instructions here: https://docs.wso2.com/display/DVS370/Deploying+a+CAR+File+with+the+Maven+Plug-In
But when I run the command:
mvn clean deploy -Dmaven.car.deploy.skip=false
I get an error that many other people get.
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to configure plugin parameters for: org.apache.maven.plugins:maven-deploy-plugin:2.4
check that the following section of the pom.xml is present and correct:
<distributionManagement>
<!-- use the following if you're not using a snapshot version. -->
<repository>
<id>repo</id>
<name>Repository Name</name>
<url>scp://host/path/to/repo</url>
</repository>
<!-- use the following if you ARE using a snapshot version. -->
<snapshotRepository>
<id>repo</id>
<name>Repository Name</name>
<url>scp://host/path/to/repo</url>
</snapshotRepository>
</distributionManagement>
Cause: Class 'org.apache.maven.artifact.repository.ArtifactRepository' cannot be instantiated
I don't want to deploy it to a repository, unless I am understanding this wrong.
I created a Maven Multi Module Project to package up the Java Mediator, the ESB Config Project and the Composite Application Project.
Why is this failing?
What is the correct way to deploy a car manually?
To deploy a car file 'manually' you can simply execute a "mvn clean install" and copy the .car file from the target directory and copy to <CARBON_HOME>/repository/deployment/server/carbonapps which hot-deploys the carbon app to ESB server.
While using the snapshotRepository to deploy my artifact using maven with distributionManagement
<distributionManagement>
<snapshotRepository>
<uniqueVersion>true</uniqueVersion>
<id>nexus</id>
<name>nexus Snapshots</name>
<url>http://127.0.0.1:8081/nexus/content/repositories/snapshots</url>
<layout>legacy</layout>
</snapshotRepository>
</distributionManagement>
I m stuck into the error
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.6:
deploy (default-deploy) on project abc.parent: Deployment failed: repositor
y element was not specified in the POM inside distributionManagement element or
in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]
The error looks that it is searching for repository element inside distributionManagement but i have defined snapshotRepository as per http://maven.apache.org/plugins/maven-deploy-plugin/usage.html and when I replace token with and url inside this with nexus releases repository url it works fine , I have read many suggestions and few at stackoverflow as well with same error but still struggling........................
The version of your project determines if it is going to use. snapshotRepository is ONLY going to be used if you version ends in "-SNAPSHOT", otherwise it will use the repository element.
If you do NOT use a -SNAPSHOT version... it will just upload to the repository you specify. It will, by defintion, be a release repo. Also this has nothing to do with Nexus but rather with how the Maven repository format works. Snapshot repositories are different from release repos and if you have a release (version does not end in -SNAPSHOT) you should upload to a release repo.
I have a project POM which specifies a repositories tag which points to a sandbox location.
<repositories>
<repository>
<id>mysandbox</id>
<name>Sandbox</name>
<url>http://myTestingSite.com/repositories/sandbox/</url>
</repository>
</repositories>
This works fine in Eclipse and resolves all dependencies however when i attempt to deploy i get the following exception.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy (default-depl
oy) on project myweb-web: Deployment failed: repository element was not specified in the POM insid
e distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help
1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plug
ins:maven-deploy-plugin:2.5:deploy (default-deploy) on project myweb-web: Deployment failed: repos
itory element was not specified in the POM inside distributionManagement element or in -DaltDeployme
ntRepository=id::layout::url parameter
Wrapping this in a Distributionmanagement element doesn't make any sense because I'm using the repository for dependency resolution and not deployment.
The error says you either don't have a distributionManagement element or the element isn't correct.
So this has nothing to do with the content of <repositories>. Just create a correct distributionManagement element and it will work.
Note that the broken element might be in the parent POM. Run mvn help:effective-pom to see the complete POM as Maven sees it.
The repository that you have defined originally is only taken into consideration to download dependencies, not to upload them (as you mentioned).
What you need to add is a repository inside distribution management
<distributionManagement>
<repository>
<id>id</id>
<name>name</name>
<url>nexus_url</url>
</repository>
</distributionManagement>
And if your nexus is secured, you'll also need to define a server section for the password.
<servers>
<server>
<id>id</id>
<username>username</username>
<password>password</password>
</server>
</servers>