priceline
priceline

Reputation: 3337

Please help get started with creating a simple project using eclipse, spring, maven

  1. I installed maven and configured based on their 5 minute tutorial
  2. Created a eclipse project using Maven
  3. Installed Maven Integration for eclipse by going to eclipse market place
  4. Added dependencies (spring, log4j) to pom.xml by getting the xml snippet from mvnrepository.com
  5. right click on pom.xml and run as Maven Install.

I was not able to use the new jar files immediately, had to do mvn install several times and finally all the jar files are showed up in the project.

what could be the problem? Is it not updating the class path correctly?

My questions are:

  1. Are my steps above correct?
  2. I see all the dependent jar files in the main folder. I want to place these jar files under lib folder. How do i do that?
  3. How can i add external jar file to the repository, these are not in mvnrepository
  4. How do i generate ear file to be deployed to weblogic?

Edit: Attached the screenshot of the repositoryrepository

Edit2: i picked the wrong project type. Once i picked webapp archetype, it puts all dependencies in "Maven Dependencies". This is related to my second question.

Upvotes: 0

Views: 115

Answers (3)

HRgiger
HRgiger

Reputation: 2790

After you create project use can use this command

mvn eclipse:eclipse -Dwtpversion=2.0

then install m2eclipse from eclipse marketplace. What I am doing generally is right click eclipse, import/import new maven project and choose my new maven project. Afer import if you dont see your jar folder under Libraries node of project tree, then right click build path/libraries/add class path and choose related folder.

If your library not available in current repository you can use another external repository with below tag: (jboss and java.net repos are very common)

<repositories>
        <repository>
            <id>java.net2</id>
            <url>https://repository.jboss.org/nexus.</url>
            <layout>default</layout>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>never</updatePolicy>
                <checksumPolicy>warn</checksumPolicy>
            </releases>
            <snapshots>
                <enabled>false</enabled>
                <updatePolicy>always</updatePolicy>
                <checksumPolicy>warn</checksumPolicy>
            </snapshots>
        </repository>
</repositories>

Upvotes: 0

Eshan Sudharaka
Eshan Sudharaka

Reputation: 607

For your question 3 : You can add any public maven repositories in to your pom file which contains your required jar files.
http://forum.springsource.org/showthread.php?63612-Maven-repository-location

or else if you have that jar file in your local machine you can manually install it into maven repository.

mvn install:install-file -Dfile=<path-to-file> -DgroupId=group-id  
    -DartifactId=artifact-id -Dversion=version -Dpackaging=packaging

As per the Guide to installing 3rd party JARs.

For your 2nd question you can use:

http://maven.apache.org/plugins/maven-dependency-plugin/

Upvotes: 1

Alessandro Santini
Alessandro Santini

Reputation: 2003

If you are using m2eclipse, be sure to right click on the project, select Maven and then "Update project configuration". That should be enough. I assume that you added the Maven project nature already.

Upvotes: 0

Related Questions