scala-maven-plugin excludes
2024-09-11 23:21:52
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>
最新文章
- XCodeGhost表明:为了安全,开发工具应该从官方网站下载
- dsfgsdfg
- Codeforces Round #342 (Div. 2) C. K-special Tables 构造
- vector C++ 详细用法
- Javascript之改变盒子颜色
- velocity语法
- CodeForce 339:A+B+C
- windows环境下nutch2.x 在eclipse中实现抓取数据存进mysql详细步骤
- Jquery 对话框确认
- 动态规划2-----hdu1069
- springmvc 访问时找不到配置文件
- selenium+python,解决selenium弹出新页面,无法定位元素的问题(报错:Unable to locate element:元素)
- Git原理与命令大全
- Elasticsearch.net项目实战
- SQL Server数据库————连接查询和分组查询
- 修改 jenkins 主目录
- 解决和排查 ";必须使用适当的属性和方法修改 User-Agent"; 错误时遇到的一些坑
- SAS DATA步读取数据
- windows下搭建Consul分布式系统和集群
- Liunx cannot remove `xxx&#39;: Operation not permitted