我想在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>
当我看到Heroku上的Jar时,我在那里看到了相关的课程:
~ $ 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
答案 0 :(得分:4)
类名应该是完整的,包也是。因此,<mainClass>Main</mainClass>
应该是<mainClass>edu.brandeis.cosi12b.sparkdemo.Main</mainClass>
而不是bcc
。