maven error: The desired archetype does not exist (org.phpmaven:php5-web-archetype:2.0-SNAPSHOT) - maven

I am trying to create php project using maven by tying below command:
sudo mvn archetype:generate -DarchetypeGroupId=org.phpmaven
-DarchetypeArtifactId=php5-web-archetype -DarchetypeVersion=2.0-SNAPSHOT
-DgroupId=org.sample -DartifactId=my-app -Dversion=0.0.1-SNAPSHOT
but it gives me error:
Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:generate (default-cli)
on project standalone-pom: The desired archetype does not exist (org.phpmaven:php5-web-archetype:2.0-SNAPSHOT) -> [Help 1]

Apparently you're trying to follow these instructions. If you do, you should also do the preparation steps that have been listed.
Doing that you're relying on a snapshot archetype, and those do not exist in default repositories, so you have to configure php-maven snapshot repository.
After doing that,
Confirm your settings.xml location (in the comments you indicated you had that in the wrong folder)
try with
mvn archetype:generate -DarchetypeGroupId=org.phpmaven.sites
-DarchetypeArtifactId=php5-web-archetype -DarchetypeVersion=2.0.0-beta-1
-DgroupId=org.sample -DartifactId=my-app -Dversion=0.0.1-SNAPSHOT
Since you can see from the repo that that archetype version should be in place. Note the different archetypeversion and different archetypegroupid!

Related

On adding a jar using mvn install: install-file: On project standalone-pom: The artifact information is incomplete or not valid

I want to push the bahir jar to my local m2 repository.
I'm using maven-3.5.0 downloaded tar.gz and jdk8, both are set as environment variables and are working fine.
I built apache bahir for spark from the available download from git using maven, which was BUILD SUCCESS and it created a target folder which has the jar called bahir-parent_2.11-2.3.0-SNAPSHOT-tests.jar
now when I execute:
$mvn install:install-file -Dfile=/home/awisha/trial/bahir-master/target/bahir-parent_2.11-2.3.0-SNAPSHOT-tests.jar -DgroupId=org.apache.bahir -DartifactId=spark-streaming-mqtt_2.11 -Dversion=2.2.0
Its supposed to push the jar to my local .m2/repository. But instead it gives me the following error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4:install-file (default-cli) on project standalone-pom: The artifact information is incomplete or not valid:
[ERROR] [0] 'packaging' is missing.
But when I used "apt install maven" : maven-3.3.9, I got BUILD SUCCESS
I'm not able to figure out why is it giving me error when using maven-3.5.0.
You need to simply add "-Dpackaging=jar" to your mvn install:install-file cmd:
$mvn install:install-file -Dpackage=jar
-Dfile=/home/awisha/trial/bahir-master/target/bahir-parent_2.11-2.3.0-SNAPSHOT-tests.jar
-DgroupId=org.apache.bahir -DartifactId=spark-streaming-mqtt_2.11 -Dversion=2.2.0

Maven 3 - Unable to find archetype

I have created a customized archetype, customA-web-archetype. Within the project folder, customA-web-archetype , I ran mvn clean install archetype:update-local-catalog which was successful. Now when I run mvn archetype:generate -DarchetypeCatalog=local outside the folder to use the archetype, I am getting the following error:
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
Your filter doesn't match any archetype (hint: enter to return to initial list)
FYI- When I was setting up Maven, I moved the .m2 to a different directory rather than using the default home directory. I made the appropriate change to settings.xml so that it can find the .m2 in the updated directory structure.
I am not using any repo manager such as Nexus. Just a local m2 repo sitting on the same box as the archetype project.
To run the archetype command, you need to specify the groupId, artefactId and version of your archetype, as well as those of your future maven project.
You should try the following command, with your own parameters:
mvn archetype:generate -DarchetypeCatalog=local -DarchetypeGroupId=yourArchetypeGroupId -DarchetypeArtifactId=yourArchetypeArtifactId -DarchetypeVersion=yourArchetypeVersion -DgroupId=projectGroupId -DartifactId=projectArtifactId -DinteractiveMode=false
After upgrading from Maven 2 to 3 we found the same problem. The fix was to change the version of the archetype-packaging and maven-archetype-plugin from 2.2 to 3.0.0 in the archetype pom.
I looks like maven moved the location of it's archetype repository file from ~/.m2 to ~/.m2/repositories which is why generate wasn't finding it.
One strange behavior I'm still seeing is that if I just do
mvn archetype:generate
it doesn't show my local archetypes, however if I do a
mvn archetype:generate -DarchetypeCatalog=local
it shows up. Hope this helps.
Have you tried crawling the repo to create a catalog? Perhaps it's missing / broken? Archetype plugin has crawl goal, which parses the repo and creates catalog.xml.
mvn archetype:help
[... snip ...]
archetype:crawl
Crawl a Maven repository (filesystem, not HTTP) and creates a catalog file.

maven deploy-file to private artifactory

I've set up an artifactory and I am able to to deploy my artifacts to it with mvn deploy.
However, I am unable to to deploy-file, which I am easily able to install:
mvn install:install-file -Dfile=my.jar -DgroupId=org.group -DartifactId=art -Dversion=3.0-SNAPSHOT -Dpackaging=jar
When I try:
mvn deploy:deploy-file -Durl=http://myartifactory/artifactory/repositoryId -DrepositoryId=repositoryId -Dfile=my.jar -DgroupId=org.group -DartifactId=art -Dversion=3.0-SNAPSHOT -Dpackaging=jar
I always get:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy-file (default-cli) on project standalone-pom: Failed to retrieve remote metadata org.directwebremoting:dwr:3.0.0-rc3-SNAPSHOT/maven-metadata.xml: Could not transfer metadata org.directwebremoting:dwr:3.0.0-rc3-SNAPSHOT/maven-metadata.xml from/to repository (http://triphop:8081/artifactory/repository): Access denied to: http://triphop:8081/artifactory/repository/org/directwebremoting/dwr/3.0.0-rc3-SNAPSHOT/maven-metadata.xml -> [Help 1]
In the log of the artifactory I am getting:
20130809142431|0|REQUEST|non_authenticated_user|GET|/repository/org/group/art/3.0-SNAPSHOT/maven-metadata.xml|HTTP/1.1|401|0
Why the maven is trying to fetch the meta data? Why it does not upload them?
Maven 3 works with non unique snapshots only. Which means, it needs to know how to name your snapshot. The naming depends on what's already in repository. That's the reason it downloads the metadata.

Maven deploy cant create directories

Whenever I try and do a maven deploy it can't seem to create directories and I need to do this manually.
Any idea why this might be?
mvn deploy:deploy-file -DgroupId=quickfixj -DartifactId=quickfixj-all
-Dversion=1.5.2 -Dpackaging=jar -Dfile=/dev/quickfixj/quickfixj-all-1.5.2.jar -DrepositoryId=maven-repo -Durl=https://subversion.assembla.com/svn/MYREPO/maven -X
Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy-file (default-cli) on project standalone-pom: Failed to deploy artifacts: Could not find artifact quickfixj:quickfixj-all:jar:1.5.2 in maven-repo (https://subversion.assembla.com/svn/MYREPO/maven) -> [Help 1]
However if I manually create the directories quickfixj>quickfixj-all>1.5.2 it works fine.

"Error reading POM" when selecting a archetype in Maven setup

I downloaded maven 3.0.3, set-up my environment variables as instructed and verified with mvn --version that everything looks ok. So far so good
So, time to RTFM.. about 1 minute into the manual, weirdness occurs.
mvn archetype:generate \
-DarchetypeGroupId=org.apache.maven.archetypes \
-DgroupId=com.mycompany.app \
-DartifactId=my-app
It asked me to select a archetype from this long list, I took the quickstart one 135.
However, this doesn't work.. it spits out the following error:
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-archetype-plugin:2.1:generate
(default-cli) on project standalone-pom: Error reading POM -> [Help 1]
What am I doing wrong?
Up-to-date documentation: the free book by Sonatype. I learned some stuff from there even after using Maven for over 3 years.

Resources