【问题标题】:Adding jar created using ant build with antrun plugin to maven build dependencies将使用 ant build 和 antrun 插件创建的 jar 添加到 maven 构建依赖项
【发布时间】:2020-06-16 08:02:31
【问题描述】:
  • 我有多个使用 ant 进行构建管理的项目。现在我们创建了一个使用 Maven 进行构建管理的新项目。
  • 由于使用 maven 的新项目依赖于使用 ant 构建的项目。
  • 我能够使用 maven antrun 插件将单个项目的构建集成到当前的 maven 构建中
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.8</version>
                <executions>
                    <execution>
                        <id>deploy-artifact</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <ant antfile="../project1/build.xml" inheritAll="false">
                                    <target name="dist"/>
                                </ant>
                                <ant antfile="../project2/build.xml" inheritAll="false">
                                    <target name="dist"/>
                                </ant>
                            </target>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>commons-net</groupId>
                        <artifactId>commons-net</artifactId>
                        <version>1.4.1</version>
                    </dependency>
                    <dependency>
                        <groupId>org.apache.ant</groupId>
                        <artifactId>ant-commons-net</artifactId>
                        <version>1.8.1</version>
                    </dependency>
                    <dependency>
                        <groupId>com.sun</groupId>
                        <artifactId>tools</artifactId>
                        <version>1.5.0</version>
                        <scope>system</scope>
                        <systemPath>${java.home}/../lib/tools.jar</systemPath>
                    </dependency>
                </dependencies>
            </plugin>
  • 我现在面临的问题是,当 project1 和 project2 的构建完成后,我希望将使用 ant dist 目标生成的 jar 用作当前 maven 构建中的依赖项。
  • 当前项目的 maven 构建正在中断,因为它在编译时查找 project1 和 project2 jar,但它们丢失了。我希望在当前 maven 构建中触发 project1 和 project2 的构建,并且不要使用外部命令行 mvn:install:install-file 添加依赖项

任何建议/解决方案都将受到高度赞赏。

【问题讨论】:

    标签: maven maven-3 maven-plugin maven-antrun-plugin


    【解决方案1】:

    这是不可能的。

    Maven 构建的所有依赖项都需要在构建开始之前存在。它们在构建的一开始就解决了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-19
      • 1970-01-01
      • 2010-12-07
      • 2016-05-14
      • 1970-01-01
      相关资源
      最近更新 更多