如何安装/部署由 make-maven-plugin 编译的工件

发布于 2024-10-20 14:32:24 字数 2078 浏览 0 评论 0原文

我正在使用 make-maven-plugin 使用 Maven 构建一个用 C 编写的软件。我的目标是当我运行 mvn installmvn deploy 时,自动安装源 tarball 和二进制工件并将其部署到 Maven 存储库。我当前的 pom.xml 如下所示:

<project>
  <groupId>myGroup</groupId>
  <artifactId>myProject</artifactId>
  <version>1.0</version>
  <packaging>pom</packaging>
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>make-maven-plugin</artifactId>
        <version>1.0-beta-1</version>
        <configuration>
          <destDir>${project.build.directory}/dest</destDir>
          <workDir>${basedir}</workDir>
        </configuration>
        <executions>
          <execution>
            <id>compile</id>
            <phase>compile</phase>
            <goals>
              <goal>compile</goal>
            </goals>
          </execution>
          <execution>
            <id>package</id>
            <phase>package</phase>
            <goals>
              <goal>make-dist</goal>
            </goals>
            <configuration>
              <skipDist>false</skipDist>
              <sourceArchive>${project.name}-${project.version}.tar.bz2</sourceArchive>
              <sourceArchivePath>${project.build.directory}</sourceArchivePath>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

当我打包项目时,目标目录中有以下文件:

  • myProject-2.0.bin (已编译的二进制工件)
  • -2.0.tar.bz2 (源 tar 球)

myProject 运行 mvn install 然后创建的源 tar 包和 POM 文件将安装到本地 maven 存储库。我如何告诉 Maven 也安装二进制文件?我不想用手复制它。

I'm using the make-maven-plugin to build a software written in C with Maven. My goal is to automatically install and deploy the source tarball AND the binary artifact to the Maven repository when I run mvn install and mvn deploy. My current pom.xml looks like this:

<project>
  <groupId>myGroup</groupId>
  <artifactId>myProject</artifactId>
  <version>1.0</version>
  <packaging>pom</packaging>
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>make-maven-plugin</artifactId>
        <version>1.0-beta-1</version>
        <configuration>
          <destDir>${project.build.directory}/dest</destDir>
          <workDir>${basedir}</workDir>
        </configuration>
        <executions>
          <execution>
            <id>compile</id>
            <phase>compile</phase>
            <goals>
              <goal>compile</goal>
            </goals>
          </execution>
          <execution>
            <id>package</id>
            <phase>package</phase>
            <goals>
              <goal>make-dist</goal>
            </goals>
            <configuration>
              <skipDist>false</skipDist>
              <sourceArchive>${project.name}-${project.version}.tar.bz2</sourceArchive>
              <sourceArchivePath>${project.build.directory}</sourceArchivePath>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

When I package the project then I have the following files in the target directory:

  • myProject-2.0.bin (The compiled binary artifact)
  • myProject-2.0.tar.bz2 (The source tar ball)

When running mvn install then the created source tar ball and the POM file is installed to the local maven repository. How can I tell Maven to also install the binary file? I don't want to copy it by hand.

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

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

发布评论

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

评论(1

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