• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

SimonJPegg/mvn_scalafmt: Scalafmt plugin for maven

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

SimonJPegg/mvn_scalafmt

开源软件地址(OpenSource Url):

https://github.com/SimonJPegg/mvn_scalafmt

开源编程语言(OpenSource Language):

Scala 88.7%

开源软件介绍(OpenSource Introduction):

licenseimg Codacy Coverage Build Status Total alerts

releasebadge Maven

Synopsis

A wrapper that allows the use of the Scalafmt formatter in Maven.

Usage

Add the following snippet to your pom, and it will be invoked as part of your build during the selected lifecycle phase (default validate).

Note: version.scala.binary refers to major releases of scala ie. 2.11, 2.12 or 2.13.
mvn_scalafmt_2.11 will soon be deprecated and may not receive future releases

You can also invoke the plugin directly via mvn scalafmt:format.

Versioning

This plugin follows the following versioning convention:

mvn_scalafmt_(scalaversion)-(major).(minor).(commitepoch).(commithash)

The latest release should be visible at the top of this readme.

Minimal Working POM XML:

    <plugin>
        <groupId>org.antipathy</groupId>
        <!-- The scala binary here doesn't need to match the project version -->
        <artifactId>mvn-scalafmt_${version.scala.binary}</artifactId>
        <!-- This represents the desired version of the plugin, whould be in the form:
             (major).(minor).(commitepoch).(commithash), which can be found here:
             https://github.com/simonjpegg/mvn_scalafmt/releases
             e.g. <version>1.0.1589620826.41b214a</version>
             Note: The SCALA version is OMITTED from this value
        -->
        <version>__DESIRED_MVN_SCALAFMT_VERSION__</version>
        <configuration>
            <configLocation>${project.basedir}/.scalafmt.conf</configLocation> <!-- path to config -->
        </configuration>
        <executions>
            <execution>
                <phase>validate</phase>
                <goals>
                    <goal>format</goal>
                </goals>
            </execution>
        </executions>
    </plugin>

FULL SNIPPET

<plugin>
    <groupId>org.antipathy</groupId>
    <!-- The scala binary here doesn't need to match the project version -->
    <artifactId>mvn-scalafmt_${version.scala.binary}</artifactId>
    <!-- This represents the desired version of the plugin, whould be in the form:
         (major).(minor).(commitepoch).(commithash), which can be found here:
         https://github.com/simonjpegg/mvn_scalafmt/releases
         e.g. <version>1.0.1589620826.41b214a</version>
         Note: The SCALA version is OMITTED from this value
    -->
    <version>__DESIRED_MVN_SCALAFMT_VERSION__</version>
    <configuration>
        <configLocation>${project.basedir}/.scalafmt.conf</configLocation> <!-- path to config -->
        <skipTestSources>false</skipTestSources> <!-- (Optional) skip formatting test sources -->
        <skipSources>false</skipSources> <!-- (Optional) skip formatting main sources -->
        <sourceDirectories> <!-- (Optional) Paths to source-directories. Overrides ${project.build.sourceDirectory} -->
          <param>${project.basedir}/src/main/scala</param>
        </sourceDirectories>
        <testSourceDirectories> <!-- (Optional) Paths to test-source-directories. Overrides ${project.build.testSourceDirectory} -->
          <param>${project.basedir}/src/test/scala</param>
        </testSourceDirectories>
        <validateOnly>false</validateOnly> <!-- check formatting without changing files -->
        <onlyChangedFiles>true</onlyChangedFiles> <!-- only format (staged) files that have been changed from the specified git branch -->
        <showReformattedOnly>false</showReformattedOnly> <!-- log only modified files -->
        <!-- The git branch to check against
             If branch.startsWith(": ") the value in <branch> tag is used as a command to run
             and the output will be used as the actual branch-->
        <branch>: git rev-parse --abbrev-ref HEAD</branch> <!-- the current branch-->
        <!-- <branch>master</branch>-->
        <useSpecifiedRepositories>false</useSpecifiedRepositories> <!-- use project repositories configuration for scalafmt dynamic loading -->
    </configuration>
    <executions>
        <execution>
            <phase>validate</phase> <!-- default -->
            <goals>
                <goal>format</goal>
            </goals>
        </execution>
    </executions>
</plugin>

configLocation Can either be a local path (e.g. ${project.basedir}/.scalafmt.conf) or a HTTP url (e.g https://raw.githubusercontent.com/jozic/scalafmt-config/master/.scalafmt.conf)

make sure you have set a version in your scalafmt.conf

version = "2.6.2"



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap