Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAlexey Papin
iOS Development Techdegree Graduate 26,950 PointsHelp me deploy Angular+Spark app on heroku
How to configure Todo project (REST API with Spark) for deploying it on heroku? Trying to do it using GitHub method, server couldnt find main class. Changed gradle file many times, no success, please help. My gradle:
group 'com.zzheads'
version '1.0-SNAPSHOT'
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'application'
jar {
manifest {
attributes 'MainClass' : 'com.zzheads.App'
}
}
mainClassName = "com.zzheads.App"
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile 'org.sql2o:sql2o:1.5.4'
compile 'com.h2database:h2:1.4.192'
compile 'com.sparkjava:spark-core:2.3'
compile 'com.google.code.gson:gson:2.7'
testCompile group: 'junit', name: 'junit', version: '4.11'
}
task stage {
dependsOn build
}
Main class is com.zzheads.App i believe:
package com.zzheads;
import...
public class App {
public static final String DATASOURCE = "jdbc:h2:~/data/todos.db";
public static final int PORT_NUMBER = 8080;
public static void main(String[] args) {
String datasource = DATASOURCE;
int port = PORT_NUMBER;
if (args.length > 0) {
if (args.length != 2) {
System.out.printf("java Api <port> <datasource>%n");
System.exit(0);
}
port=Integer.parseInt(args[0]);
datasource = args[1];
}
port(port);
Sql2o sql2o = new Sql2o (String.format("%s;INIT=RUNSCRIPT from 'classpath:db/init.sql'", datasource), "", "");
... // and so on