Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use Spring roo in existing project that doesn't use Maven?

Tags:

Spring Roo can be use in existing projects that follow standard maven layout. So far this appears to mean that projects that doesn't use maven are out of luck.

I am wondering what (if any) are the options for such existing projects.

Re-arrange the project layout to conform to Maven layout? This appears to be very difficult path for projects with years of history in CVS due to the fact that method for moving around directories in CVS is extremely invasive.

Are there any other options like modifying Maven configuration to work with non-standard layouts? What I recall from my earlier reading about this subject, Maven's CoC approach doesn't favor such non-standard layouts.

Edit:

Rich's answer below shows that over-riding the defaults in super-pom is trivial. That leaves us with the question whether Spring Roo will play nicely with such modifications. This is doubtful given the fact the Spring Roo doesn't use Maven itself.

Edit:

Rich's updated answer shows that, by default, ROO will use hard coded paths and will not pick modifications in your pom.xml So answer so far appears to be that it isn't possible out-of-the-box but can be done by some custom coding (or asking ROO team to support this)

like image 545
Tahir Akhtar Avatar asked Aug 05 '09 07:08

Tahir Akhtar


2 Answers

You can modify Maven to use a different set of conventions. The standard set are inherited from the Maven super POM and can be overridden by redefining the relevant property.

For example, to change the sources directory from src/main/java to src, the test directory to test-src, and the resources directory from src/main/resources to resources you would set the following in your POM:

<build>
  <sourceDirectory>src</sourceDirectory>
  <testSourceDirectory>test-src</testSourceDirectory>
  <resources>
    <resource>
      <directory>resources</directory>
    </resource>
  </resources>
</build>

Be aware that a few plugins might not use the standard properties to access the locations (e.g. hardcoding target/classes instead of using ${project.build.outputDirectory}, so you might have the odd problem.


Update: It looks like Roo currently has these properties hardcoded. You may be able to replace the MavenPathResolver or add an additional resolver to use the custom properties.

If this is a real problem for you, you can raise a request to get the MavenPathResolver modified to allow custom locations.

like image 25
Rich Seller Avatar answered Sep 30 '22 14:09

Rich Seller


There's no reason we (the Roo team) cannot make the MavenPathResolver allow custom paths to be used, and one of the intentional reasons I created a PathResolver abstraction was to support customisation of common path locations not only to Maven non-default locations but also to other build systems like Ant+Ivy. all base Roo add-ons have been written to use the PathResolver so it shouldn't be a major effort to support this. Please add an enhancement request to the Roo Jira instance if you'd still like this support.

like image 89
Ben Alex Avatar answered Sep 30 '22 14:09

Ben Alex