Announcement Announcement Module
Collapse
No announcement yet.
Add external jar into spring roo Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Add external jar into spring roo

    I have two roo projects.

    - In the first project I'm using roo 1.1.3 for creating the model (Entities) with gwt.
    - In the second project I'm using gVNix 0.7 (roo 1.1.4) for create the web service.

    I tried exporting the jar from the first project to be included in the second, but throws me problems..

    First Project

    package com.example
    ...

    @Entity
    Client
    String name;

    Second Project
    import com.example.Client;
    ...
    @Service
    TestService

    public void createClient(String name) {
    Client c = new Client(),
    ....

  • #2
    What problems? Did you add the jar to your pom.xml ? If not, add it with the Roo "dependency add" command

    Comment


    • #3
      I tried to add the dependence into pom.xml, but did not know how to reference the jar physically, I'm new to this, you give me an example?

      Comment


      • #4
        Adding it to the POM is one thing, but Maven also has to be able to resolve what it finds there. So if you add this to your POM:

        Code:
        <dependency>
            <groupId>foo.bar</groupId>
            <artifactId>baz</artifactId>
            <version>1.2</version>
        </dependency>
        ... Maven will look in your local repository (which on *Nix is ~/.m2/repository) for a file called foo/bar/baz-1.2.jar. If it doesn't find it there, it will search all remote repositories it knows about; by default this is Maven Central, but you can add others to your POM or its parent POM. You can check which repos are known to your project by running mvn help:effective-pom and looking for the "<repositories>" element. If the JAR file is one you've created yourself, then it won't be in any public repos, but you can add it to your local repo using "mvn install". Just make sure the groupId, artifactId, version, and packaging of your JAR project match up with those you used when adding the dependency to the project that uses the JAR.

        Does that help?

        Comment


        • #5
          Hi again,

          I did the steps that tell me and I could access the Client class (external jar with dependecy add), but then to make a debug, I realized that I skipped the call to persist.

          1. Client newClient = new Client()
          2. newClient.setName("XXX")
          3. newClient.persist()

          The application never run line 3 and skip to the next line.

          Comment

          Working...
          X