Create a Maven project with hibernate - eclipse

I need to create a maven project, which also has hibernate. How do i write the maven create project command.
The IDE i'm using is Eclipse.

If you're asking what archetype would be best to use from the command line, then the below will give you a nice list to choose from:
mvn archetype:generate
However, you say you're using Eclipse - if so, take advantage of the Maven integration and you'll be offered a similar choice when creating the project (basically just a nice GUI around archetype:generate and friends)

What you need is an appropriate maven archetype E.g.:
mvn archetype:generate -B \
-DgroupId=com.my-company.my-project \
-DartifactId=my-project-domain \
-DpackageName=com.company.project.domain \
-DarchetypeGroupId=com.rfc.maven.archetypes \
-DarchetypeArtifactId=jpa-maven-archetype \
-DremoteRepositories=http://maven.rodcoffin.com/repo \
-DarchetypeVersion=1.0.0
You can find some Hibernate archetypes here http://docs.codehaus.org/display/MAVENUSER/Archetypes+List
or use google

Related

Where to download Square Wire wire-compiler-VERSION-jar-with-dependencies.jar?

I want to use protobuf in Android , and I find Square Wire. https://github.com/square/wire
In the document, there is a command to gerate Java file.
% java -jar wire-compiler-VERSION-jar-with-dependencies.jar \
--proto_path=src/main/proto \
--java_out=out \
squareup/dinosaurs/dinosaur.proto \
squareup/geology/period.proto
I download the released zip, but there are all source code, no Jar file.
Then ,I went to Maven Respoist, but there is no wire-compiler-VERSION-jar-with-dependencies.jar
You can build it yourself with maven
Get sources, install maven and run
mvn package
You'll find wire-compiler-VERSION-jar-with-dependencies.jar in wire/wire-compiler/target/ directory.
Wire's README has a link to download the latest JAR from maven.org.

Failed to create Maven Project in eclipse

I added maven plugin in my eclipse .. but still can't create Maven project (doesn't exist in new project ) and i can't find it also in window -> preferences .. can any one tell me what's wrong please !?
May be Maven Integration (m2e) plugin not installed properly(check the eclipse version & try to install suitable plugin).
Alternately you could create maven project via command,
For core java project,
mvn archetype:generate -DgroupId={project-packaging} -DartifactId={project-name} -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
For Webapplication,
mvn archetype:generate -DgroupId={project-packaging} -DartifactId={project-name} -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false
Kindly refer the below link:
http://www.mkyong.com/tutorials/maven-tutorials/

Maven works but eclipse error

I created a maven project from the command-line interface. Configured the dependencies with my other maven projects. Now when I run my project, it works without any problem using the following maven command:
$ mvn clean
$ mvn install
$ mvn exec:java
Hello world!
Then, I use the following maven command to have my eclipse project files.
$ mvn eclipse:eclipse
I go and open my project using Eclipse Kepler, however as you can see there is a exclamation point on my project and it does not run from eclipse.
The problem is I do not know how to find the error on eclipse..

How would you add maven to an existing GWT project in Eclipse with m2e installed?

The project has GWTQuery included. I'd like to have the pom.xml generated in the existing project so I can configure the build.
You can start with an empty pom.xml by defining your project attributes first and add your dependency to gwtquery
<dependency>
<groupId>com.googlecode.gwtquery</groupId>
<artifactId>gwtquery</artifactId>
<version>1.3.3</version>
</dependency>
Another way is to generate a new project using an archetype:
Step 1:
mvn archetype:generate
Step 2: choose 44, which at the time of writing means: 44: remote -> com.googlecode.gwtquery:gquery-archetype (This archetype generates a Gwt-2.5.0-rc1 project with all set to use GwtQuery and its plugins.)
Step 3: enter your project information
The best way I see is to create a new maven-ready project using gwtquery archetype and setting the same namespaces and module name that you use in your current project.
mvn archetype:generate -DarchetypeGroupId=com.googlecode.gwtquery \
-DarchetypeArtifactId=gquery-archetype \
-DarchetypeVersion=1.3.3 \
-DgroupId=com.mycompany \
-DartifactId=myproject \
-DprojectName=MyProject
Then import the maven project in eclipse (use m2e plugin) and check if it works (dev mode, tests, etc).
Copy all your source code from your src folder to the new project src/main/java, the same with your public stuff, .gwt.xml file, and tests.
And finally add your dependencies to your pom using the eclipse pom editor.
Note: The m2e feature of converting a normal eclipse project to maven needs a lot of work.

Maven2 + Eclipse 3.5 web Project Errors

I'm using Maven 2.2 to build Simple Web Project and Integrate it to Eclipse:
I'm doing it the following way:
1) Going to my workspace directory using command line:
2) Create Project using the following command:
mvn archetype:generate -DgroupId=com.vanilla.test -DartifactId=myTest -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false
3) Convert this project to Eclipse project:
cd myTest
mvn eclipse:eclipse -Dwtpversion=R7
When I import then project to Eclispe I have red 'x' on the project name. Although, I tried to Clean project, to refresh it or run index.jsp, I can't fix it.
No any other problems with the project.
Why does it happen?
Perhaps you should configure the workspace before converting to Eclipse project.
mvn eclipse:configure-workspace -Declipse.workspace=<path-of-your-workspace>