maven-bundle-plugin: The defined artifact is not an archetype - maven

I configured the "maven-bundle-plugin" from Apache Felix as a Maven Archetype in Eclipse (since it was missing), but when I try to create a new Maven project with it, I get as error:
Unable to create project from archetype [org.apache.felix:
maven-bundle-plugin:2.3.5 -> ]
The defined artifact is not an archetype
I then tried the same procedure with ops4j Pax (which is pre-configured in Eclipse), which seems to be something similar, and it worked, so I think I'm doing it right and the problem is with "maven-bundle-plugin".
What does the error message mean, and what can I do to fix it, or am I somehow getting this all wrong?
[EDIT] While I can create the project with ops4j Pax, I afterward get:
Project build error: Unknown packaging: bundle
which as apparently been fixed in 2009! So this obviously doesn't work either.

I finally had success with the following procedure:
cd workspace
mvn org.ops4j:maven-pax-plugin:create-bundle -Dpackage=demo.service
-DbundleGroupId=demo.service -DbundleName=demo.service-bundle
-Dversion=0.1
cd demo.service-bundle
mvn org.ops4j:maven-pax-plugin:eclipse
# Import project as Eclipse project
# (I haven't try to import it as maven project)
And btw, it took me about ages to work out why this doesn't work in a Windows batch file: that is because mvn is itself a batch file, and so you have to use "call".

Related

Teamcity Issue :Unable to add module to the current project as it is not of packaging type 'pom'

I am trying to add Maven build step in TeamCity to generate Maven archetype.
mvn archetype:generate
This works fine in command prompt.
Unfortunately it throws below error in TeamCity:
Failed to execute goal
org.apache.maven.plugins:maven-archetype-plugin:3.0.1:generate
(default-cli) on project pso-jms-listener-archetype:
org.apache.maven.archetype.exception.InvalidPackaging: Unable to add
module to the current project as it is not of packaging type 'pom'
I created a new folder and tried executing it there, but still throws the same error
Any suggestions would help.
You may already have a POM file in the directory where mvn archetype:generate is executed.
For Maven, archetype is
a Maven project templating toolkit. An archetype is defined as an
original pattern or model from which all other things of the same kind
are made.
In short, you are creating a project (from a template) in an other project.
In your project folder, delete the file pom.xml and use mvn archetype:generate again.

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.

Add Archtypes to Eclipse

I am new to MAVEN and restful services. I have MAVEN installed it correctly and set the variables. I was creating a webservice using the jersey-quickstart-webapp but found it did not appeared in the list of Archetypes.
I tried to add it using using ADD Archetypes option. After the entering the details
GroupId: org.glassfish.jersey.archetypes
ArtifactId: jersey-quickstart-webapp
Version : 2.16 // version is correct??
I get following error please help.
<b>
org.eclipse.core.runtime.CoreException: Could not resolve artifact
org.glassfish.jersey.archetypes:jersey-quickstart-webapp:pom:2.16</b>
I don't have a ready explanation as to why the Eclipse archetype plugin was giving you this error, since 2.16 is a valid version of jersey-quickstart-webapp. However, I would recommend that you try manually executing the following command from a command prompt:
mvn archetype:generate -DarchetypeArtifactId=jersey-quickstart-webapp
-DarchetypeGroupId=org.glassfish.jersey.archetypes -DinteractiveMode=false
-DgroupId=com.example -DartifactId=simple-service-webapp -Dpackage=com.example
-DarchetypeVersion=2.19
Make sure that you first delete the jersey-quickstart-webapp folder, if it exists, from your Maven .m2 directory. This may be necessary to avoid from something getting corrupted during the archetype install.
Here is a link to the official documentation for creating a Jersey EE application from a Maven archetype.

Maven and Jsig CAS 4.0RC

I have downloaded the code from the repository but I have little experience to use maven (command line) to get the .war file to be included in my tomcat.
I do not have experience in this.
I have not changed the pom.xml file
I directly run the command mvn clean package but I have several errors.
Spete help me?
My goal is to generate the. War file CAS 4.0RC
I'm using the pom.xml file that I found on git (a very long file) can fit that?
If you've downloaded the source of CAS and its by itself should be a mavenized project then, pom.xml should be inside.
so you should just 'cd' to the root folder of your source and type
mvn install
or
mvn package
The first command will install your jar into local maven repository, the second one will only prepare the war in the target folder of the module with packaging war in the source.
If you encounter any errors, please post them here.
Hope this helps
It should build without any problem when executing mvn clean install in the CLI... What are your errors ?

Maven eclipse plugin error Lorg/sonatype/plexus/build/incremental/BuildContext;

Can someone let me know how to fix the same?.I tried to create a new maven project and it fails for some reason
Description Resource Path Location Type
Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:2.5:resources failed: A required class was missing while executing org.apache.maven.plugins:maven-resources-plugin:2.5:resources: Lorg/sonatype/plexus/build/incremental/BuildContext;
Have updated the maven-resource-plugin to version 2.6. It works fine with M2Eclipse integration v1.3 milestone.
My experience with eclipse and maven is not good I have been working for a long time with both and they don't integrate properly. The best way to make them work together for me was to use command line to build, package and install the projects and eclipse to edit.
To import the projects into eclipse I just use mvn eclipse:eclipse and it will generate the files needed to import the project into eclipse.

Resources