jQuery in Action, 2nd edition*
The moose likes Ant, Maven and Other Build Tools and the fly likes Usage of maven Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Usage of maven" Watch "Usage of maven" New topic
Author

Usage of maven

Gopi Chand Maddula
Greenhorn

Joined: May 15, 2008
Posts: 2
Hi,
I am new to use maven. i just learned the steps ofinstalling the project and creating the project structure using the maven command

"mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-app"

and once gone through the project structure. but my confusion is that when all this process should be done. i.e., before creating our class files or after creating our class files.

what i mean is should we do the process before starting the project or after completing the project.
[ May 27, 2008: Message edited by: Gopi Chand Maddula ]
Hongli Li
Ranch Hand

Joined: Oct 29, 2006
Posts: 124
you use archetype:create to create a new maven-compliant project layout. the folder structure is in maven format. It's meaningless to run this command after you created your project. This tool only eases the process of creating a maven project, and it's not mandatory to use.

in maven 2.0.9 you should use mvn archetype:generate instead of mvn archetype:create.
[ May 27, 2008: Message edited by: Hongli Li ]

Do you know why this cup is useful? Because it is empty.
Gopi Chand Maddula
Greenhorn

Joined: May 15, 2008
Posts: 2
Thanks for your Concern Hongli Li

now i am learning to work on Hibernate project using maven project structure.
if i execute the command

mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-app

the folder structure may look like this


my-app/pom.xml
/src/main/com/company/app/App.java
/test/java/com/mycompany/app/AppTest.java

i am placing my java files in the place of App.java and my confusion is where should i place my mapping files and Hibernate Configuration files.




[ May 27, 2008: Message edited by: Gopi Chand Maddula ]
Uli Hofstoetter
Ranch Hand

Joined: Nov 24, 2006
Posts: 57
I am always getting a bit of a headache when people start to use code generators and similar stuff before they understand, what they are generating.

I recommend you to set up a maven project manually, learn about the standard maven directory structure and all the other maven stuff.

But btt ... the hibernate mapping files usually are put into src/main/resources.

Regards
Uli


SCEA5, Certified ScrumMaster
Hongli Li
Ranch Hand

Joined: Oct 29, 2006
Posts: 124
Originally posted by Gopi Chand Maddula:
Thanks for your Concern Hongli Li

now i am learning to work on Hibernate project using maven project structure.
if i execute the command

mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-app

the folder structure may look like this


my-app/pom.xml
/src/main/com/company/app/App.java
/test/java/com/mycompany/app/AppTest.java

i am placing my java files in the place of App.java and my confusion is where should i place my mapping files and Hibernate Configuration files.





[ May 27, 2008: Message edited by: Gopi Chand Maddula ]

You are welcome,Gopi.

Put the mapping xml files alongside your java file,hibernate group uses that way, I did this before it would be even better to use annotations, then you even won't bother to writer those mapping files. Don't forget anything you put under resources folder will also be available on the classpath. resources and src are in the same folder which should be your base folder.
Hongli Li
Ranch Hand

Joined: Oct 29, 2006
Posts: 124
Originally posted by Hongli Li:

You are welcome,Gopi.

Put the mapping xml files alongside your java file,hibernate group uses that way, I did this before it would be even better to use annotations, then you even won't bother to writer those mapping files. Don't forget anything you put under resources folder will also be available on the classpath. resources and src are in the same folder which should be your base folder.hibernate configuration file can be put in the same folder as com in your case
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Usage of maven