Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: How to "Push In" Roo Generated Code...

  1. #11

    Default

    Quote Originally Posted by Andrew Swan View Post
    Also if you are running your app from your IDE, make sure that the src\main\resources folder is on the classpath; I don't know about NetBeans, but Eclipse doesn't do this by default.
    Ok thanks... sorry for sounding so green, but how do I "make sure src\main\resources folder is on the classpath" ?

  2. #12
    Join Date
    May 2006
    Location
    Madrid
    Posts
    382

    Default

    For COC (Convention Over Configuration) MAVEN has the four folders (java and resources for tests and main) in the classpath. If you didn't modify the pom.xml, using mvn from the command line will work.

    In Eclipse, if you have the maven plugin (STS has it), you can right-click on the project->Maven (it has a bold red icon "m2")->Update project configuration. It will do the job for you.

    Again, in Eclipse, you can do that manually with right-click on the project->Properties->Java Build Path, find the "Source" tab where you configure the "source folders on the build path". I don't recommend you to modify manually this option, it's better to let the maven plugin to do that, but if you're using another IDE without this plugin, it should have an option like that, in order to configure the output folder for the classes and resources (properties, xmls and so on)

  3. #13

    Default

    Quote Originally Posted by jbbarquero View Post
    Yes.

    Within the STS, expand the .aj in order to see its methods and select the desired ones (more on that plural, later) and right-click -> Refactor -> Push in...

    You can see what is going to be moved. Next/Next or Finish will do the job.

    )
    Thanks, this worked fine when it came to displaying the *.aj files but and when I performed the push in on a specific method, that method disappeared from the .aj file but where it went, I have no idea, as it is NOT in the corresponding .java file :-( ... help!

  4. #14
    Join Date
    May 2006
    Location
    Madrid
    Posts
    382

    Default

    Quote Originally Posted by BlakkPhoenixx View Post
    Thanks, this worked fine when it came to displaying the *.aj files but and when I performed the push in on a specific method, that method disappeared from the .aj file but where it went, I have no idea, as it is NOT in the corresponding .java file :-( ... help!
    There is an intermediate screen on the Push in...'s wizard that inform you of the target Java file.

    Besides, you need to move all the related elements. If a method use an attribute (for instance, the *.aj integration tests uses an instance of the DataOnDemand), you need to select both the method and the dod variable and Push them in the Java file.

    Furthermore, all the files involved in the "Push in..." operation need to be correct (I mean, they have no compilation errors) before performing the push.

    Be careful with the Roo Shell. Sometimes it's better to operate with the shell closed, managing the files AND the Roo annotations, and then re-start the Shell.

  5. #15
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    667

    Lightbulb Good tip

    Quote Originally Posted by jbbarquero View Post
    There is an intermediate screen on the Push in...'s wizard that inform you of the target Java file.

    Besides, you need to move all the related elements. If a method use an attribute (for instance, the *.aj integration tests uses an instance of the DataOnDemand), you need to select both the method and the dod variable and Push them in the Java file.

    Furthermore, all the files involved in the "Push in..." operation need to be correct (I mean, they have no compilation errors) before performing the push.

    Be careful with the Roo Shell. Sometimes it's better to operate with the shell closed, managing the files AND the Roo annotations, and then re-start the Shell.
    These are good tips. If you want to be sure that code's not going to be lost when you do a push-in, there's a "Preview" button in the refactor dialog that shows you what the pushed-in code will look like. If you only see the source .aj file in this dialog and not the target .java file, cancel the refactoring and check the things listed above.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •