Maven编译插件包排除不起作用

时间:2015-09-27 22:14:24

标签: maven maven-compiler-plugin

我有一个针对3个版本的依赖项构建的项目。最旧的版本有许多不兼容的更改,这些更改会提示我排除使用它们的唯一包:

<profiles>
    <profile>
        <id>spark-1.3.1</id>
        <properties>
            <spark.version>1.3.1</spark.version>
        </properties>

        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <excludes>
                            <exclude>**/tribbloids/spookystuff/pipeline/**</exclude>
                        </excludes>
                        <testExcludes>
                            <testExclude>**/tribbloids/spookystuff/pipeline/**</testExclude>
                        </testExcludes>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>

但是,当我使用-Pspark-1.3.1参数进行编译后执行任何maven命令时,仍然会收到排除包中所有scala文件的错误信息:

[INFO] Compiling 54 Scala sources and 9 Java sources to /home/peng/git/spookystuff/core/target/scala/classes...
[ERROR] /home/peng/git/spookystuff/core/src/main/scala/com/tribbloids/spookystuff/pipeline/GoogleSearchTransformer.scala:28: not found: value setDefault
[ERROR]   setDefault(Pages -> 0, PageCol -> null, IndexCol -> null)
[ERROR]   ^
[ERROR] /home/peng/git/spookystuff/core/src/main/scala/com/tribbloids/spookystuff/pipeline/GoogleSearchTransformer.scala:37: not found: value getOrDefault
[ERROR]       .wgetExplore(S"div#foot a:contains(Next)", maxDepth = getOrDefault(Pages), depthKey = $(PageCol), optimizer = Narrow)
[ERROR]                                                             ^
[ERROR] /home/peng/git/spookystuff/core/src/main/scala/com/tribbloids/spookystuff/pipeline/TransformerLike.scala:19: value defaultCopy is not a member of com.tribbloids.spookystuff.pipeline.TransformerLike
[ERROR]   def copy(extra: ParamMap): TransformerLike = this.defaultCopy(extra)
[ERROR]                                                     ^
[ERROR] /home/peng/git/spookystuff/core/src/main/scala/com/tribbloids/spookystuff/pipeline/TransformerLike.scala:26: value defaultCopy is not a member of com.tribbloids.spookystuff.pipeline.SpookyTransformer
[ERROR]   override def copy(extra: ParamMap): SpookyTransformer = this.defaultCopy(extra)
[ERROR]                                                                ^
[ERROR] /home/peng/git/spookystuff/core/src/main/scala/com/tribbloids/spookystuff/pipeline/TransformerLike.scala:31: not found: value getOrDefault
[ERROR]     val colName = Option(getOrDefault(col))

此问题的原因是什么?如何解决?

1 个答案:

答案 0 :(得分:0)

问题解决了,我的代码是用Scala编写的,我必须在maven-scala-plugin中做同样的事情。