目标网net.alchim31.maven:scala-maven-plugin:4.0.0的执行scala-compile-first

问题描述

我正在尝试构建一个spark scala项目并出现以下错误

net.alchim31.maven:scala-maven-plugin:4.0.0:在项目CognitiveClassifier上编译(scala-compile-first)在目标net.alchim31.maven:scala-maven-plugin上执行scala-compile-first :4.0.0:编译失败:对于工件{null:null:null:jar}:groupId不能为空

我可以在MacOS和IntelliJ上构建它,但是当我尝试在Linux机器上运行它时,出现错误

我的pom文件粘贴在下面

4.0.0

<groupId>com.bm.cdc</groupId>
<artifactId>CDC</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>CDC</name>
<url>http://maven.apache.org</url>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <scala.version>2.11.12</scala.version>
    <scala.build.version>2.11</scala.build.version>
    <spark.version>2.3.2</spark.version>
    <akka.http.version>10.1.5</akka.http.version>
    <akka.core.version>2.5.17</akka.core.version>
    <MysqL.version>8.0.19</MysqL.version>
</properties>

<repositories>
    <repository>
        <id>Maven Central</id>
        <url>http://central.maven.org/maven2/</url>
    </repository>

</repositories>

<dependencies>
    <dependency>
        <groupId>org.scala-lang</groupId>
        <artifactId>scala-library</artifactId>
        <version>${scala.version}</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.spark</groupId>
        <artifactId>spark-core_${scala.build.version}</artifactId>
        <version>${spark.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.spark</groupId>
        <artifactId>spark-mllib_${scala.build.version}</artifactId>
        <version>${spark.version}</version>
    </dependency>
    <dependency>
        <groupId>com.typesafe.akka</groupId>
        <artifactId>akka-http_${scala.build.version}</artifactId>
        <version>${akka.http.version}</version>
    </dependency>
    <dependency>
        <groupId>com.typesafe.akka</groupId>
        <artifactId>akka-actor_${scala.build.version}</artifactId>
        <version>${akka.core.version}</version>
    </dependency>
    <dependency>
        <groupId>com.typesafe.akka</groupId>
        <artifactId>akka-testkit_${scala.build.version}</artifactId>
        <version>${akka.core.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.typesafe.akka</groupId>
        <artifactId>akka-http-spray-json_2.11</artifactId>
        <version>${akka.http.version}</version>
    </dependency>

    <dependency>
        <groupId>com.typesafe.akka</groupId>
        <artifactId>akka-stream_${scala.build.version}</artifactId>
        <version>${akka.core.version}</version>
    </dependency>
    <dependency>
        <groupId>com.typesafe.akka</groupId>
        <artifactId>akka-stream-testkit_${scala.build.version}</artifactId>
        <version>${akka.core.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>MysqL</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>${MysqL.version}</version>
    </dependency>
</dependencies>
<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
                <version>3.4.4</version>
            </plugin>
        </plugins>
    </pluginManagement>
    <plugins>
        <plugin>
            <groupId>net.alchim31.maven</groupId>
            <artifactId>scala-maven-plugin</artifactId>
            <executions>
                <execution>
                    <id>scala-compile-first</id>
                    <phase>process-resources</phase>
                    <goals>
                        <goal>add-source</goal>
                        <goal>compile</goal>
                    </goals>
                </execution>
                <execution>
                    <id>scala-test-compile</id>
                    <phase>process-test-resources</phase>
                    <goals>
                        <goal>testCompile</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>3.2.0</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <minimizeJar>true</minimizeJar>
                        <filters>
                            <filter>
                                <artifact>*:*</artifact>
                                <excludes>
                                    <exclude>meta-inf/*.SF</exclude>
                                    <exclude>meta-inf/*.DSA</exclude>
                                    <exclude>meta-inf/*.RSA</exclude>
                                </excludes>
                            </filter>
                        </filters>

                    <transformers>
                        <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                            <resource>reference.conf</resource>
                        </transformer>
                    </transformers>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <!-- Build an executable JAR -->
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>3.0.2</version>
            <configuration>
                <archive>
                    <manifest>
                        <mainClass>com.bm.cdc.ws.SparkServer</mainClass>
                    </manifest>
                </archive>
            </configuration>
        </plugin>
        <!-- https://mvnrepository.com/artifact/org.codehaus.mojo/exec-maven-plugin -->

    </plugins>
</build>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)