我可以在不使用 Maven 的现有项目中使用 Spring roo 吗?

发布于 2024-07-30 02:52:25 字数 966 浏览 8 评论 0 原文

Spring Roo 可以在 遵循标准 Maven 布局。 到目前为止,这似乎意味着不使用 Maven 的项目是不走运的。

我想知道此类现有项目的选项是什么(如果有)。

重新安排项目布局以符合 Maven 布局? 对于 CVS 中具有多年历史的项目来说,这似乎是非常困难的道路,因为 在 CVS 中移动目录 的方法是极具侵入性的。

是否还有其他选项,例如修改 Maven 配置以使用非标准布局? 我记得我之前阅读过有关这个主题的内容,Maven 的 CoC 方法不支持这种非- 标准布局。

编辑:

下面 Rich 的回答表明,覆盖 super-pom 中的默认值是微不足道的。 这给我们留下了一个问题:Spring Roo 是否能很好地适应这些修改。 鉴于 Spring Roo 本身不使用 Maven,这一点值得怀疑。

编辑:

Rich 的更新答案表明,默认情况下,ROO 将使用硬编码路径,并且不会选择 pom.xml 中的修改 所以到目前为止的答案似乎是不可能开箱即用,但可以通过一些自定义编码来完成(或要求 ROO 团队支持这一点)

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)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

无妨# 2024-08-06 02:52:25

我们(Roo 团队)没有理由不能让 MavenPathResolver 允许使用自定义路径,我创建 PathResolver 抽象的有意原因之一是支持自定义公共路径位置,不仅支持 Maven 非默认位置,还支持自定义路径其他构建系统,如 Ant+Ivy。 所有基本 Roo 附加组件均已编写为使用 PathResolver,因此支持此功能不应该是一项重大工作。 如果您仍需要此支持,请向 Roo Jira 实例添加增强请求。

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.

高速公鹿 2024-08-06 02:52:25

您可以修改 Maven 以使用一组不同的约定。 标准集继承自Maven super POM并且可以通过重新定义相关属性来覆盖。

例如,要将源目录从 src/main/java 更改为 src,将 test 目录更改为 test-src,并将资源目录从 src/main/resources 更改为 resources,您需要在 POM 中设置以下内容

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

:少数插件可能不使用标准属性来访问位置(例如,硬编码目标/类而不是使用 ${project.build.outputDirectory},因此您可能会遇到奇怪的问题。


更新:看起来 Roo 目前有这些 属性硬编码。您可以替换 MavenPathResolver 或添加其他解析器来使用自定义属性。

如果这对您来说确实是个问题,您可以 提出请求以修改 MavenPathResolver 以允许自定义位置。

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.

剑心龙吟 2024-08-06 02:52:25

自 Roo 1.2 起尚未实施。

As of Roo 1.2 it is not implemented.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文