多个 Maven pom.xml 文件

发布于 2024-10-01 19:22:20 字数 218 浏览 4 评论 0原文

我有一个带有 GWT 客户端和 Restlet API 的 Eclipse 项目。我通常使用 Maven 进行依赖关系管理,但我还没有在 Eclipse 项目中使用它,其中单独的部分具有单独的依赖关系。例如 - 客户端将使用 Google Gin 进行依赖注入,服务器使用 Google Guice。

我是否能够将其拆分为两个单独的 pom.xml 文件来管理两个单独区域的依赖关系?

谢谢

I have an Eclipse project with a GWT client and a Restlet API. I normally use Maven for dependency management but I havent used it in an Eclipse project where seperate parts have seperate dependencies. For example - the client would use Google Gin for dependency injection and the server uses Google Guice.

Am I able to split it into two seperate pom.xml files to manage the dependencies of both seperate areas?

Thanks

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

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

发布评论

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

评论(2

爱要勇敢去追 2024-10-08 19:22:20

您可以创建一个多模块项目。请参阅此处此处此处

You can create a multi module project. See examples here and here and here.

乱世争霸 2024-10-08 19:22:20

您可以像这样创建一个新的 pom:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                             http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.mycompany</groupId>
    <artifactId>your-dependencies</artifactId>
    <version>1.0.0</version>
    <packaging>pom</packaging>

    <dependencies>
        ...
        <dependency>
            <groupId>com.sun.mail</groupId>
            <artifactId>mailapi</artifactId>
            <version>1.5.0</version>
        </dependency>
        ...
    </dependencies>
</project>

然后在您的原始项目中添加:

<dependencies>
    <dependency>
        <groupId>com.mycompany</groupId>
        <artifactId>your-dependencies</artifactId>
        <version>1.0.0</version>
        <type>pom</type>
    </dependency>
</dependencies>

You could create a new pom like this:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                             http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.mycompany</groupId>
    <artifactId>your-dependencies</artifactId>
    <version>1.0.0</version>
    <packaging>pom</packaging>

    <dependencies>
        ...
        <dependency>
            <groupId>com.sun.mail</groupId>
            <artifactId>mailapi</artifactId>
            <version>1.5.0</version>
        </dependency>
        ...
    </dependencies>
</project>

Then in your original project just add:

<dependencies>
    <dependency>
        <groupId>com.mycompany</groupId>
        <artifactId>your-dependencies</artifactId>
        <version>1.0.0</version>
        <type>pom</type>
    </dependency>
</dependencies>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文