错误:无法找到或加载主类scala Eclipse IDE

问题描述 投票:0回答:1

我通过我的GitHub存储库克隆了该项目。每当试图运行时,它都会给出错误:

找不到主要课程。

我有我的pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<artifactId>Scalable ML</artifactId>
<groupId>org.big-mint</groupId>
<version>0.0.1-SNAPSHOT</version>

<name>Scalable ML</name>
<description>
    Scalable Machine learning algorithms to process big data.
</description>

<inceptionYear>2017</inceptionYear>


<licenses>
    <license>
        <name>GNU GENERAL PUBLIC LICENSE, Version 3</name>
        <url>http://www.gnu.org/licenses/gpl-3.0.txt</url>
        <distribution>repo</distribution>
    </license>
</licenses>
<properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <scala.version>2.11.8</scala.version>
    <scala.binary.version>2.11</scala.binary.version>
    <spark.version>2.1.1</spark.version>
    <sansa.version>0.2.0</sansa.version>
    <jena.version>3.1.1</jena.version>
</properties>

<dependencies>
    <!-- Scala -->
    <dependency>
        <groupId>org.scala-lang</groupId>
        <artifactId>scala-library</artifactId>
        <version>${scala.version}</version>
    </dependency>

    <!-- Apache Spark Core -->
    <dependency>
        <groupId>org.apache.spark</groupId>
        <artifactId>spark-core_${scala.binary.version}</artifactId>
        <version>${spark.version}</version>
    </dependency>
    <!-- Apache Spark SQL -->
    <dependency>
        <groupId>org.apache.spark</groupId>
        <artifactId>spark-sql_${scala.binary.version}</artifactId>
        <version>${spark.version}</version>
    </dependency>

    <!-- Apache JENA 3.x -->
    <dependency>
        <groupId>org.apache.jena</groupId>
        <artifactId>apache-jena-libs</artifactId>
        <type>pom</type>
        <version>${jena.version}</version>
    </dependency>

    <!-- SANSA RDF -->
    <dependency>
        <groupId>net.sansa-stack</groupId>
        <artifactId>sansa-rdf-spark-bundle_${scala.binary.version}</artifactId>
        <version>${sansa.version}</version>
    </dependency>

    <!-- SANSA OWL -->
    <dependency>
        <groupId>net.sansa-stack</groupId>
        <artifactId>sansa-owl-spark_${scala.binary.version}</artifactId>
        <version>${sansa.version}</version>
    </dependency>

    <!-- SANSA Inference -->
    <!-- <dependency> <groupId>${project.groupId}</groupId> <artifactId>sansa-inference-parent_${scala.binary.version}</artifactId> 
        <version>${sansa.version}</version> </dependency> -->
    <dependency>
        <groupId>net.sansa-stack</groupId>
        <artifactId>sansa-inference-spark_${scala.binary.version}</artifactId>
        <version>${sansa.version}</version>
    </dependency>

    <!-- SANSA Querying -->
    <dependency>
        <groupId>net.sansa-stack</groupId>
        <artifactId>sansa-query-spark-bundle_${scala.binary.version}</artifactId>
        <version>${sansa.version}</version>
    </dependency>

    <!-- SANSA ML -->
    <dependency>
        <groupId>net.sansa-stack</groupId>
        <artifactId>sansa-ml-spark_${scala.binary.version}</artifactId>
        <version>${sansa.version}</version>
    </dependency>

    <!-- Test -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.8.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.scalatest</groupId>
        <artifactId>scalatest_${scala.binary.version}</artifactId>
        <version>2.2.6</version>
        <scope>test</scope>
    </dependency>

    <!-- Logging -->
    <dependency>
        <groupId>com.typesafe.scala-logging</groupId>
        <artifactId>scala-logging-slf4j_${scala.binary.version}</artifactId>
        <version>2.1.2</version>
    </dependency>

</dependencies>

<build>
    <sourceDirectory>src/main/scala</sourceDirectory>
    <testSourceDirectory>src/test/scala</testSourceDirectory>
    <plugins>
        <plugin>
            <groupId>net.alchim31.maven</groupId>
            <artifactId>scala-maven-plugin</artifactId>
            <version>3.2.1</version>
            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                        <goal>testCompile</goal>
                    </goals>
                    <configuration>
                        <args>
                            <!--<arg>-make:transitive</arg> -->
                            <arg>-dependencyfile</arg>
                            <arg>${project.build.directory}/.scala_dependencies</arg>
                        </args>
                    </configuration>
                </execution>
            </executions>
            <configuration>
                <scalaVersion>${scala.version}</scalaVersion>
                <recompileMode>incremental</recompileMode>
            </configuration>
        </plugin>

        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>${maven.compiler.source}</source>
                <target>${maven.compiler.target}</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>2.4.3</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <artifactSet>
                            <excludes>
                                <exclude>asm:asm</exclude>
                                <exclude>com.clearspring.analytics:stream</exclude>
                                <exclude>com.esotericsoftware:kryo*</exclude>
                                <exclude>com.esotericsoftware:minlog</exclude>
                                <exclude>com.fasterxml.jackson.core:jackson*</exclude>
                                <exclude>com.fasterxml.jackson.module:jackson-module*</exclude>
                                <exclude>com.google.code.findbugs:jsr305</exclude>
                                <exclude>com.google.code.gson:gson</exclude>
                                <exclude>com.google.inject.extensions:guice-servlet</exclude>
                                <exclude>com.google.guava:guava</exclude>
                                <exclude>com.google.protobuf:protobuf-java</exclude>
                                <exclude>com.jcraft:jsch</exclude>
                                <exclude>com.ning:compress-lzf</exclude>
                                <exclude>com.sun.jersey:jersey-*</exclude>
                                <exclude>com.sun.jersey.contribs:jersey-guice</exclude>
                                <exclude>com.sun.xml.bind:jaxb-impl</exclude>
                                <exclude>com.thoughtworks.paranamer:paranamer</exclude>
                                <exclude>com.twitter:chill*</exclude>
                                <exclude>com.univocity:univocity-parsers</exclude>
                                <exclude>commons-beanutils:commons-beanutils*</exclude>
                                <exclude>commons-cli:commons-cli</exclude>
                                <exclude>commons-codec:commons-codec</exclude>
                                <exclude>commons-collections:commons-collections</exclude>
                                <exclude>commons-configuration:commons-configuration</exclude>
                                <exclude>commons-digester:commons-digester</exclude>
                                <exclude>commons-httpclient:commons-httpclient</exclude>
                                <exclude>commons-io:commons-io</exclude>
                                <exclude>commons-lang:commons-lang</exclude>
                                <exclude>commons-logging:commons-logging</exclude>
                                <exclude>commons-net:commons-net</exclude>
                                <exclude>io.dropwizard.metrics:metrics*</exclude>
                                <exckude>io.netty:netty*</exckude>
                                <exclude>javax.activation:activation</exclude>
                                <exclude>javax.annotation:javax.annotation-api</exclude>
                                <exclude>javax.servlet:javax.servlet-api</exclude>
                                <exclude>javax.servlet.jsp:jsp-api</exclude>
                                <exclude>javax.servlet:servlet-api</exclude>
                                <exclude>javax.validation:validation-api</exclude>
                                <exclude>javax.ws.rs:javax.ws.rs-api</exclude>
                                <exclude>javax.xml.bind:jaxb-api</exclude>
                                <exclude>javax.xml.stream:stax-api</exclude>
                                <exclude>jdk.tools:jdk.tools</exclude>
                                <exclude>net.java.dev.jets3t:jets3t</exclude>
                                <exclude>net.jpountz.lz4:lz4</exclude>
                                <exclude>net.razorvine:pyrolite</exclude>
                                <exclude>net.sf.py4j:py4j</exclude>
                                <exclude>org.antlr:antlr4-runtime</exclude>
                                <exclude>org.apache.avro:avro*</exclude>
                                <exclude>org.apache.commons:commons-lang3</exclude>
                                <exclude>org.apache.commons:commons-math3</exclude>
                                <exclude>org.apache.commons:commons-compress</exclude>
                                <exclude>org.apache.curator:curator*</exclude>
                                <exclude>org.apache.directory.api:*</exclude>
                                <exclude>org.apache.directory.server:*</exclude>
                                <exclude>org.apache.hadoop:*</exclude>
                                <exclude>org.apache.htrace:htrace-core</exclude>
                                <exclude>org.apache.httpcomponents:*</exclude>
                                <exclude>org.apache.ivy:ivy</exclude>
                                <exclude>org.apache.mesos:mesos</exclude>
                                <exclude>org.apache.parquet:parquet*</exclude>
                                <exclude>org.apache.spark:*</exclude>
                                <exclude>org.apache.xbean:xbean-asm5-shaded</exclude>
                                <exclude>org.apache.zookeeper:zookeeper</exclude>
                                <exclude>org.codehaus.jackson:jackson-*</exclude>
                                <exclude>org.codehaus.janino:*</exclude>
                                <exclude>org.codehaus.jettison:jettison</exclude>
                                <exclude>org.fusesource.leveldbjni:leveldbjni-all</exclude>
                                <exckude>org.glassfish.hk2*</exckude>
                                <exclude>org.glassfish.jersey*</exclude>
                                <exclude>org.javassist:javassist</exclude>
                                <exclude>org.json4s:json4s*</exclude>
                                <exclude>org.mortbay.jetty:jetty*</exclude>
                                <exclude>org.objenesis:objenesis</exclude>
                                <exclude>org.roaringbitmap:RoaringBitmap</exclude>
                                <exclude>org.scala-lang:*</exclude>
                                <exclude>org.slf4j:jul-to-slf4j</exclude>
                                <exclude>org.slf4j:jcl-over-slf4j</exclude>
                                <exclude>org.spark-project.spark:unused</exclude>
                                <exclude>org.xerial.snappy:snappy-java</exclude>
                                <exclude>oro:oro</exclude>
                                <exclude>xmlenc:xmlenc</exclude>
                            </excludes>
                        </artifactSet>
                        <filters>
                            <filter>
                                <artifact>*:*</artifact>
                                <excludes>
                                    <exclude>META-INF/*.SF</exclude>
                                    <exclude>META-INF/*.DSA</exclude>
                                    <exclude>META-INF/*.RSA</exclude>
                                </excludes>
                            </filter>
                        </filters>
                        <createDependencyReducedPom>false</createDependencyReducedPom>
                    </configuration>
                </execution>
            </executions>
        </plugin>

        <!-- disable surefire -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.7</version>
            <configuration>
                <useFile>false</useFile>
                <disableXmlReport>true</disableXmlReport>
                <!-- If you have classpath issue like NoDefClassError,... -->
                <!-- useManifestOnlyJar>false</useManifestOnlyJar -->
                <includes>
                    <include>**/*Test.*</include>
                    <include>**/*Suite.*</include>
                </includes>
                <skipTests>true</skipTests>
            </configuration>
        </plugin>

        <!-- enable scalatest -->
        <plugin>
            <groupId>org.scalatest</groupId>
            <artifactId>scalatest-maven-plugin</artifactId>
            <version>1.0</version>
            <configuration>
                <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
                <junitxml>.</junitxml>
                <filereports>WDF TestSuite.txt</filereports>
            </configuration>
            <executions>
                <execution>
                    <id>test</id>
                    <goals>
                        <goal>test</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

<repositories>
    <repository>
        <id>oss-sonatype</id>
        <name>oss-sonatype</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>apache-snapshot</id>
        <name>Apache repository (snapshots)</name>
        <url>https://repository.apache.org/content/repositories/snapshots/</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>maven.aksw.internal</id>
        <name>AKSW Release Repository</name>
        <url>http://maven.aksw.org/archiva/repository/internal</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>maven.aksw.snapshots</id>
        <name>AKSW Snapshot Repository</name>
        <url>http://maven.aksw.org/archiva/repository/snapshots</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

有几个maven和其他依赖项。我不知道为什么它不加载主类。我已经尝试了许多其他人提到的解决方案,即在运行配置中提供完整的类名等等。但没有任何效果。

scala maven
1个回答
0
投票

尝试添加此属性:

<properties>
    <jobMainClass>package.mainclass</jobMainClass>
</properties>

如果它不起作用,请给我用于运行jar文件的命令。

© www.soinside.com 2019 - 2024. All rights reserved.