zoukankan      html  css  js  c++  java
  • scala-maven-plugin excludes

    Hello, every one.

    I have a problem to add excludes to scala-maven-plugin. There are two scala files:Spark_1.6.1.scala and Spark_2.0.1.scala in src/main/scala/test. I want to exclude Spark_1.6.1.scala when compilation, so I write a pom.xml with the following setups. But it doesn't work.

    May I do something incorrectly? How to add excludes correctly ?

    在pom.xml文件中,引入scala-maven-plugin,将一部分文件排除编译工作:

    scala-maven-plugin不支持完全模式匹配,仅支持/test/scala/和 /main/scala下的模式匹配。故而,在配置文件中需要配置成按包名路径的模式。

    Sorry, it was my fault. I didn't realize that /test/ cannot be a part of exclude pattern; patterns only are applied to path inside /test/scala/ or /main/scala. 
     
    <excludes>
        <exclude>**/com/excludes_package/**</exclude>
        <exclude>**/com/excludes_package/excludes_package_1/**</exclude>
        <exclude>**/com/excludes_package/excludes_package_2/**</exclude>
    </excludes>

    此外incremental模式下貌似不支持excludes,需要注释掉。Java的compiler中也需要加入exclude,否则在build中Java build阶段会报错。

    <!-- mixed Java/Scala projects, see https://davidb.github.io/scala-maven-plugin/example_java.html -->
    <plugin>
        <!-- see http://davidb.github.com/scala-maven-plugin -->
        <groupId>net.alchim31.maven</groupId>
        <artifactId>scala-maven-plugin</artifactId>
        <version>3.2.2</version>
        <executions>
            <execution>
                <id>eclipse-add-source</id>
                <goals>
                    <goal>add-source</goal>
                </goals>
            </execution>
            <execution>
                <id>scala-compile-first</id>
                <phase>process-resources</phase>
                <goals>
                    <goal>compile</goal>
                </goals>
            </execution>
            <execution>
                <id>scala-test-compile-first</id>
                <phase>process-test-resources</phase>
                <goals>
                    <goal>testCompile</goal>
                </goals>
            </execution>
            <execution>
                <id>attach-scaladocs</id>
                <phase>verify</phase>
                <goals>
                    <goal>doc-jar</goal>
                </goals>
            </execution>
        </executions>
        <configuration>
            <scalaVersion>${scala.version}</scalaVersion>
            <!-- <recompileMode>incremental</recompileMode> <!-- here --> 
            <useZincServer>true</useZincServer> -->
            <args>
                <arg>-unchecked</arg>
                <arg>-deprecation</arg>
                <arg>-feature</arg>
                <arg>-language:postfixOps</arg>
            </args>
            <jvmArgs>
                <jvmArg>-Xms1024m</jvmArg>
                <jvmArg>-Xmx1024m</jvmArg>
                <jvmArg>-XX:ReservedCodeCacheSize=${CodeCacheSize}</jvmArg>
            </jvmArgs>
            <javacArgs>
                <javacArg>-source</javacArg>
                <javacArg>${java.version}</javacArg>
                <javacArg>-target</javacArg>
                <javacArg>${java.version}</javacArg>
                <javacArg>-Xlint:all,-serial,-path</javacArg>
            </javacArgs>
            <excludes> <!-- here --> 
                <exclude>**/com/excludes_package/**</exclude>
                <exclude>**/com/excludes_package/excludes_package_1/**</exclude>
                <exclude>**/com/excludes_package/excludes_package_2/**</exclude>
            </excludes>
        </configuration>
    </plugin>
    <!-- This plugin compiles Java files -->
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.6.1</version>
        <configuration>
            <source>${java.version}</source>
            <target>${java.version}</target>
            <encoding>UTF-8</encoding>
            <maxmem>1024m</maxmem>
            <fork>true</fork>
            <compilerArgs>
                <arg>-Xlint:all,-serial,-path</arg>
            </compilerArgs>
            <excludes> <!-- here --> 
                <exclude>**/com/excludes_package/**</exclude>
                <exclude>**/com/excludes_package/excludes_package_1/**</exclude>
                <exclude>**/com/excludes_package/excludes_package_2/**</exclude>
            </excludes>
        </configuration>
        <executions>
            <execution>
                <phase>compile</phase>
                <goals>
                    <goal>compile</goal>
                </goals>
            </execution>
        </executions>
    </plugin>

    经验证:incremental模式下支持excludes,不需要注释掉。

    <recompileMode>incremental</recompileMode>
  • 相关阅读:
    appium+python自动化项目实战(一):引入nose和allure框架
    jmeter+WebDriver:启动浏览器进行web自动化
    jmeter强大的扩展插件!!
    jmeter+Fiddler:通过Fiddler抓包生成jmeter脚本
    appium+python自动化测试真机测试时报错“info: [debug] Error: Could not extract PIDs from ps output. PIDS: [], Procs: ["bad pid 'uiautomator'"]”
    Appium+python移动端自动化测试-python库及pycharm安装(二)
    Appium+python移动端自动化测试-环境搭建(一)
    安全测试之bWAPP环境搭建
    Battery Historian之App耗电量测试
    (15)Docker之用Nginx实现SpringBoot应用的负载均衡简单记录
  • 原文地址:https://www.cnblogs.com/suanec/p/9813603.html
Copyright © 2011-2022 走看看