首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将gradle/sbt/maven项目转换为pants构建系统

将gradle/sbt/maven项目转换为pants构建系统
EN

Stack Overflow用户
提问于 2019-01-21 13:43:54
回答 1查看 779关注 0票数 2

我正在为一个项目(scala)使用,我需要使用一些第三方依赖项,这些依赖项可以作为gradle、sbt或maven导入。是否有一种标准的方法可以将gradle.build/头文件/build.sbt/plugin转换为gradle.build文件?

下面的pom (插件部分)就是一个例子,说明在某种程度上需要转换成裤子。

谢谢

代码语言:javascript
复制
    <build>
    <sourceDirectory>src/main/scala</sourceDirectory>
    <plugins>
      <plugin>
        <groupId>net.alchim31.maven</groupId>
        <artifactId>scala-maven-plugin</artifactId>
        <version>3.4.1</version>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
              <goal>testCompile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>com.lightbend.akka.grpc</groupId>
        <artifactId>akka-grpc-maven-plugin</artifactId>
        <version>${akka.grpc.version}</version>
        <configuration>
          <language>Scala</language>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>generate</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- disable surefire -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.7</version>
        <configuration>
          <skipTests>true</skipTests>
        </configuration>
      </plugin>

      <!-- enable scalatest -->
      <plugin>
        <groupId>org.scalatest</groupId>
        <artifactId>scalatest-maven-plugin</artifactId>
        <version>1.0</version>
        <configuration>
          <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
          <junitxml>.</junitxml>
          <filereports>TestSuite.txt</filereports>
          <argLine>-javaagent:${org.mortbay.jetty.alpn:jetty-alpn-agent:jar}</argLine>
        </configuration>
        <executions>
          <execution>
            <id>test</id>
            <goals>
              <goal>test</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.5.1</version>
        <executions>
          <execution>
            <id>getClasspathFilenames</id>
            <goals>
              <!-- provides the jars of the classpath as properties inside of maven
                   so that we can refer to one of the jars in the exec plugin config below -->
              <goal>properties</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.6.0</version>
        <executions>
          <execution>
            <id>server</id>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>java</executable>
              <arguments>
                <argument>-javaagent:${org.mortbay.jetty.alpn:jetty-alpn-agent:jar}</argument>
                <argument>-classpath</argument>
                <classpath />
                <argument>com.example.helloworld.GreeterServer</argument>
              </arguments>
            </configuration>
          </execution>
          <execution>
            <id>client</id>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>java</executable>
              <arguments>
                <argument>-classpath</argument>
                <classpath />
                <argument>com.example.helloworld.GreeterClient</argument>
                <argument>${GreeterClient.user}</argument>
              </arguments>
            </configuration>
          </execution>
        </executions>      
      </plugin>
    </plugins>
  </build>
EN

回答 1

Stack Overflow用户

发布于 2020-01-15 22:54:11

我不相信有任何工具可以将现有的poms转换为Pants。我认为目前还没有类似于几乎任何Maven插件的Pants插件。

似乎最好的选择是为您无法生存的转换制作Pants插件,并将您的构建转换为您正在迁移到的构建工具的标准(遗憾的是)。

下面是一些关于创建新插件的文档:

tasks.html

将代码Avro转换为一些Java代码的示例插件(对于基于Java的代码转换来说似乎是最好的启动程序):

https://github.com/pantsbuild/pants/tree/master/contrib/avro/src/python/pants/contrib/avro

或者,您可以使用jvm_prep_command并以更简单的方式运行所需的java进程:

dictionary.html

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54291302

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档