Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to set up a minimal Maven pom.xml file for a Heroku worker process in Java?
    primarykey
    data
    text
    <p>First off: I'm not a Java coder. I'm new to the Java/Maven tool chain. We're using a Java library for a project which we want to launch as a Heroku background worker.</p> <p>This project relies on two external libraries, the mongodb Java driver which is available through Maven's central repo, and another third party library. I've seen the <a href="https://devcenter.heroku.com/articles/local-maven-dependencies" rel="nofollow">Heroku article on "unmanaged dependencies"</a>, but something else appears missing, as I get an error like: <code>Could not find the main class: com.company.myproject.MyApp Program will exit.</code> when I try to run the app locally according to <a href="https://devcenter.heroku.com/articles/java#build_and_run_your_app_locally" rel="nofollow">Heroku's instructions on "Getting Started with Java"</a>.</p> <p>I noticed that their pom.xml file contains a Maven plugin <code>maven-dependency-plugin</code> to copy dependencies, and when I check my <code>target/classes</code> folder, I don't see any of the dependencies.</p> <p>Heroku also publishes a <a href="https://devcenter.heroku.com/articles/run-non-web-java-processes-on-heroku" rel="nofollow">guide on building background workers in Java</a>. That <code>pom.xml</code> contains a build assembly plugin, which seems more complex.</p> <p>I'm a bit lost in all this ceremony (especially coming from Rails), and I'd like to stat with the simplest possible <code>pom.xml</code> to get this running. Is there a Maven archetype file for Java workers on Heroku? I'm also using NetBeans as IDE, and it would be great to use the IDE tools for this, if available, but it's a secondary priority.</p> <p>Below my <code>pom.xml</code> so far:</p> <pre><code>&lt;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"&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;groupId&gt;com.myproject&lt;/groupId&gt; &lt;artifactId&gt;myproject&lt;/artifactId&gt; &lt;version&gt;0.1&lt;/version&gt; &lt;packaging&gt;jar&lt;/packaging&gt; &lt;name&gt;myproject&lt;/name&gt; &lt;url&gt;http://maven.apache.org&lt;/url&gt; &lt;properties&gt; &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt; &lt;/properties&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;junit&lt;/groupId&gt; &lt;artifactId&gt;junit&lt;/artifactId&gt; &lt;version&gt;3.8.1&lt;/version&gt; &lt;scope&gt;test&lt;/scope&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.mongodb&lt;/groupId&gt; &lt;artifactId&gt;mongo-java-driver&lt;/artifactId&gt; &lt;version&gt;2.7.3&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.thirdparty&lt;/groupId&gt; &lt;artifactId&gt;thirdparty&lt;/artifactId&gt; &lt;version&gt;0.2.9&lt;/version&gt; &lt;scope&gt;provided&lt;/scope&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;repositories&gt; &lt;repository&gt; &lt;id&gt;project-local&lt;/id&gt; &lt;name&gt;Project-local Repo&lt;/name&gt; &lt;url&gt;file:${project.basedir}/repo&lt;/url&gt; &lt;/repository&gt; &lt;/repositories&gt; &lt;/project&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload