I'm following the tutorial from Red Hat and I'm running a query in maven:
mvn archetype:generate
-DarchetypeGroupId=io.fabric8.archetypes
-DarchetypeArtifactId=karaf-camel-cbr-archetype
-DarchetypeVersion=1.2.0.redhat-630187
-DgroupId=tutorial
-DartifactId=tx-jms-router
-Dversion=1.0-SNAPSHOT
-Dfabric8-profile=tx-jms-router-profile
But I see an error
[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 doe
s not exist (io.fabric8.archetypes:karaf-camel-cbr-archetype:1.2.0.redhat-630187
) -> [Help 1]
I tried to create a maven project using the Jboss Developer Studio, but the result was the same
If you look here
...you'll notice the artifact is not in central maven repo.
So the problem is that you need to tell Maven to look also in non-default places.
Therefore, you need to edit your settings.xml and add an extra repository (in the above link, you are pointed towards the right repository).
https://maven.repository.redhat.com/ga/
Edit: Related to adding repositories in settings.xml (related to your comment below). There are two things wrong with your listing:
You're missing an activeProfiles tag as seen here (you only have activeProfile)
The fact that you were missing the activeProfiles tag and you DID NOT got a Maven error leads me to believe that you modified the wrong settings.xml. Did you tried to modify the one from the .m2 folder?
try this
-DarchetypeRepository=http://repo.open.iona.com/maven2
Related
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.
I was compiling an "old" open sourced project, while encountered this problem:
[ERROR] Failed to execute goal on project .... Can not transfer artifact x:y:z from ...
the artifact x:y:z is not found from all repositories defined in the project pom.xml.
After looked up the effective pom.xml, I could not find any references to x:y:z.
How can I find out which artifact or plugin is requesting a missing dependency without analyze all transitive dependencies?
If you use eclipe - you can see dep tree like this: open pom.xml and tick "Dependency Hierarchy" tab.
Also you can try to use mvn dependency:tree but I am not totally sure that it will work if some of your deps are missing.
UPDATE: seems like both eclipse and dependency:tree require sucessfull artifact resolution to work whch is not your case.
In this case I guess you're left with 3 opttions:
clean your cache (wipe everything under ~/.m2/repository), run your build and do occurence search (search for something like "problematic-artifact-id") on files in your ~/.m2/repository. One or couple of the artifacts should reference the problematic artifact in their pom. This should give you a hint.
clean your cache and run your build with -X switch. This will put maven in verbosity mode and you should find some hints about what might reference dead dependency (point your attention on download order, what artifacts got resolved, check dependencies of resolved artifacts in their poms)
dumb as hell - comment/uncomment deps in your pom and see what causes the mentioned error.
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!
I've worked a little with m2eclipse in Eclipse Indigo and now I'm trying to use Maven from command line without Eclipse and without m2eclipse plugin. The m2eclipse has abililty to resolve the artifacts from the workspace without installing them to repository and this feature allows me to run my build without problems in Eclipse , but in CMD I'm getting the errors of missing jars.
[WARNING] The POM for AAA_7.1.1:ConfigurationView:jar:0.0.1-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for AAA_7.1.1:Beans:jar:0.0.1-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[ERROR] Failed to execute goal on project Client: Could not resolve dependencies for project AAA_7.1.1:Client:pom:0.0.1-SNAPSHOT:.......
Our goal is to keep the repo clean as much as possible , that's the reason why I'd like to keep it working in a such way.
So my question is how to resolve the dependencies without installing them to repo and if it's possible at all?
IMO, the standard way to go with Maven is mvn clean install.
But if I understand well your problem, you want to keep your local repository as clean as possible ?
One way to do that would be to use multiple local repositories, but I don't think it's possible at the moment (Maven 3.0).
However you can use alternate local repo with -Dmaven.repo.local or alternate settings with mvn --settings (see answer).
See also :
Previous question : maven workspace local repository
JIRA : Allow multiple local repositories (Unresolved)
Local repository separation -> workspaces don't seem to be implemented at the moment...
Basically you want a maven build, where the reactor contains all your 97 modules. To do this:
Create a parent, which contains all those 97 modules as children (if you are already multi module, you just need to configure the already existing parents to be the children of this new parent). Than start your build at that new parent. The convention is normally to have the parent in the upper directory. But you may also use relative paths that contain .. for the module location specification. There is also no need to inherit from the new parent in the existing parents. So you do not need to change any of the existing poms.
I have a maven project with the following hierarchy as created with NetBeans:
root/
Parent/
pom.xml
Project 1/
pom.xml
Project 2/
pom.xml
....
Project x/
pom.xml
When I try the release:perform it fails when attempting to deploy:
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project (C:\checkout\pom.xml) has 1 error
[ERROR] Non-readable POM C:\checkout\pom.xml: C:\checkout\pom.xml (The system cannot find the file specified)
It looks like the plugin expects the pom to be on the root folder. I was unable to find a customization point on the plug-in to specify the pom.xml location.
Is this not possible, or did I organize the project wrong?
Searching on the net I found this post which pointed me to a question with the answer here.
It looks like you are trying to run mvn release:perform from your checkout root directory, while you should cd to Parent instead.
I assume that your project is indeed stored under Subversion or some other Maven-supported version control tool and that you checked it out in your C:\checkout directory.