Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Heroku上的Java可以';找不到Main.class_Java_Maven_Heroku - Fatal编程技术网

Heroku上的Java可以';找不到Main.class

Heroku上的Java可以';找不到Main.class,java,maven,heroku,Java,Maven,Heroku,我正在尝试在Heroku上运行一个非常简单的Spark应用程序。它在当地运行良好。我怀疑这是一些微妙的Maven问题,因为我使用了Heroku的一些Maven脚本,我不太理解 以下是我的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.apa

我正在尝试在Heroku上运行一个非常简单的Spark应用程序。它在当地运行良好。我怀疑这是一些微妙的Maven问题,因为我使用了Heroku的一些Maven脚本,我不太理解

以下是我的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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>SparkDemo</groupId>
    <artifactId>SparkDemo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <build>
        <sourceDirectory>src</sourceDirectory>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <descriptorRefs>
                        <!-- This tells Maven to include all dependencies -->
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>
                            <mainClass>Main</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.heroku.sdk</groupId>
                <artifactId>heroku-maven-plugin</artifactId>
                <version>0.4.4</version>
                <configuration>
                    <jdkVersion>1.8</jdkVersion>
                    <!-- Use your own application name -->
                    <appName>still-journey-10861</appName>
                    <processTypes>
                        <!-- Tell Heroku how to launch your application -->
                        <!-- You might have to remove the ./ in front -->
                        <web>java -jar target/SparkDemo-0.0.1-SNAPSHOT-jar-with-dependencies.jar</web>
                    </processTypes>
                </configuration>
            </plugin>

        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>com.sparkjava</groupId>
            <artifactId>spark-core</artifactId>
            <version>2.3</version>
        </dependency>
        <dependency>
            <groupId>com.j2html</groupId>
            <artifactId>j2html</artifactId>
            <version>0.5.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-csv</artifactId>
            <version>1.2</version>
        </dependency>
    </dependencies>
</project>

类名应该是完整的,包也是完整的。因此,它应该是
edu.brandeis.cosi12b.sparkdemo.Main
而不是
Main
,类名应该是完整的,包也应该是完整的。因此,它应该是
edu.brandeis.cosi12b.sparkdemo.Main,而不是
Main

~ $ jar tf target/SparkDemo-0.0.1-SNAPSHOT.jar
META-INF/
META-INF/MANIFEST.MF
edu/
edu/brandeis/
edu/brandeis/cosi12b/
edu/brandeis/cosi12b/sparkdemo/
edu/brandeis/cosi12b/sparkdemo/Main.class
edu/brandeis/cosi12b/sparkdemo/StudentChooserServer.class
edu/brandeis/cosi12b/sparkdemo/StudentDirectory.class
edu/brandeis/cosi12b/sparkdemo/StudentInfo.class
studentnames.csv
META-INF/maven/
META-INF/maven/SparkDemo/
META-INF/maven/SparkDemo/SparkDemo/
META-INF/maven/SparkDemo/SparkDemo/pom.xml
META-INF/maven/SparkDemo/SparkDemo/pom.properties