Maven archetype quickstart with resources folder - maven

When I use Maven archetype quickstart, it does not create src/main/resources
folder and I have to create it myself. Why is it like this?
I want src/main/resources to be created automatically.
Is there a better archetype for this?

If you are frequently creating projects from quickstart but require a resources directory, then create your own custom archetype and install it to your repository (local cache or the one used by your team).
The source for the archetype, which you can check out anonymously and modify, is here:
http://svn.apache.org/viewvc/maven/archetypes/trunk/maven-archetype-quickstart/

This maven archetype is an enhanced combination of the quickstart and webapp maven archetypes:
https://github.com/sabram/maven-archetype-quickweb
The project it creates will include both src/main/java and src/main/resources as well as src/test and src/webapp...
Feel free to use and delete any folders you don't need, or fork the archetype for your own needs.

That happened to me too. The only solution that I've found was create the /src/main/resources and also /src/main/java for myself. Other parts of maven-archetype works fine for me.

Related

How can I get only the JAR file?

I had two projects using the same code for a functionality. To avoid that, I isolated this code in a new project so the two projects can use this functionality by indicating the dependency in their pom.xml file. So, once that I created the new project with the repeated, I save in innersource as a maven repository.
In the pom.xml file of both projects I used tag with and inside to indicate where is the repository. When I update the projects the dependency is downloaded from the remote repository and it works, but when I saw the Maven dependencies section of my project, where all needed JARs are, I found that is not only downloaded the JAR file of the third project, but there is a folder with the project.
So how I can get the JAR and not a folder?
Thank you so much for your help!

How to convert alfresco ant based project in alfresco5 maven based?

I am using alfresco 4.1.3 having following project structure.
I am using the ant script to build project.
Now I want to convert this project into maven based alfresco5.
I have configured alfresco5 using all-in-one archetype and I am able to run it successfully. My questions are:
How can I convert my alfresco ant based project in alfresco5 maven based?
Do I need to add src files in repo or repo-amp?
Do I need to copy all share related files in share or share-amp?
Any help would be greatly appreciated!!!
Thanks in Advance.!!
That totally depends on the ant build setup. But one good guess is that you will have to put the files residing in the "Alfresco" folder of your old project into different subfolders of the repo-amp, and the same way around with the "Share" folder. Most files will go into those folders, you have to study the SDK-docs carefully to know into which folders the files will go. Depending of the nature of your extensions some files could go into the Share and Alfresco war-structure as well (additions to web.xml for example).
There are no "Swiss army knife" for that works for all cases here.
Good luck
Do the following things:
Create new project as maven project and provide group id (it's yours) artifact id as alfresco5 and version (ex:43.0.1-SNAPSHOT)
With this it creates maven based folder structure
src/main/java -> replace it with your src folder
3.src/main/resources ->add your Share, reference and Alfresco folders.
look at you lib directory..what ever .jar will be there you need to define it in dependencies under pom.xml
compile the whole project..if there are compilation errors then add required dependencies in pom.xml

How to point Maven IDEA plugin what type of module to generate?

I have a project that consists of several modules (app. 10-12). I use maven idea plugin to generate .iml for each module, but I have one problem. All modules are of JAVA_MODULE type, but plugin generates main module as J2EE_WEB_MODULE. I think it is because there's .war files and WEB_INF folders in target folder, but these ones are for Tomcat usage. Anyway, at the end I must edit .iml file and change J2EE_WEB_MODULE to JAVA_MODULE.
Is there any way to make maven plugin generate a module of specific type? Or maybe there's a workaround that lets one change with maven, using regexp, module type in .iml?
Thank you in advance.
Do not use the maven-idea-plugin, it is obsolete and has not been updated since 2008.
Just open the project by pointing to the pom.xml.
The guys at JetBrains has done a perfect job with their own maven integration.

2 WARs in maven EAR build

I am new to maven and as a matter of fact new to the build tools and process or should i say the whole web structure. I have a slight problem for which i need help.
I am going to make a web project which on compiling/deployment will give a war file. And i have a separate project for which the war(just the war file after bundling the project) file will be given to me.
Now my requirement is to make a EAR file comprising both my project bundle and also including the war of the other completed project. I need to use maven for this.
I know the multi-module projects can be created using maven. But i am not sure how it will handle isolated war file. I mean for my project it will have the whole structure , artifactId and groupId. What about the other war how will it be handled.
I know this may be a novice question. But can someone please help.
Thanks
The way this would typically be handled would be making the isolated WAR file a dependency. Install it in your local maven repo and just list it as a dependency in the POM for your EAR module. Also, making your WAR project a module under your EAR project would handle the WAR that you're actually building.

How maven know which archetype is used?

I am wonder how maven know which archetype is used for specified pom.xml
I didn't find any difference between pom.xml of maven-archetype-quickstart and that of maven-archetype-webapp.
These are two different Questions:
I am wonder how maven know which
archetype is used for specified
pom.xml
The archetype plugin is usually used interactively. You just call mvn archetype:create, and the wizard walks you through the different steps. There's nothing you need to configure in a pom. In fact it would be silly to put archetype information in an existing project, as archetypes are for creating new projects.
I did not found any difference between
pom.xml of maven-archetype-quickstart
and that of maven-archetype-webapp.
The main difference is that webapp contains a folder src/main/webapp which contains your static web resources and the WEB-INF folder. Also, the packaging is set to war. So maven-archetype-quickstart is the default for creating a simple jar project, while maven-archetype-webapp is the default for creating a simple war project.

Resources