Skip to content
This repository has been archived by the owner on Jan 28, 2024. It is now read-only.

Commit

Permalink
Upgraded Jetty version and switched to using copy-dependencies instea…
Browse files Browse the repository at this point in the history
…d of appassembler
  • Loading branch information
Jesper Joergensen committed Jan 31, 2012
1 parent f6e9edb commit c763041
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 35 deletions.
2 changes: 1 addition & 1 deletion Procfile
@@ -1 +1 @@
web: sh target/bin/webapp web: java -cp target/classes:target/dependency/* HelloWorld
35 changes: 15 additions & 20 deletions README.md
Expand Up @@ -83,7 +83,7 @@ You can run any Java application on Heroku that uses Maven as build tool. As an


## Declare Dependencies in `pom.xml` ## Declare Dependencies in `pom.xml`


Cedar recognizes Java apps by the existence of a `pom.xml` file. Here's an example `pom.xml` for the Java/Jetty app we created above. The `maven-appassembler-plugin` generates an execution wrapper with the correct `CLASSPATH`. Cedar recognizes Java apps by the existence of a `pom.xml` file. Here's an example `pom.xml` for the Java/Jetty app we created above.


### pom.xml ### pom.xml


Expand All @@ -100,7 +100,7 @@ Cedar recognizes Java apps by the existence of a `pom.xml` file. Here's an examp
<dependency> <dependency>
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId> <artifactId>jetty-servlet</artifactId>
<version>7.4.5.v20110725</version> <version>7.6.0.v20120127</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>
Expand All @@ -111,22 +111,14 @@ Cedar recognizes Java apps by the existence of a `pom.xml` file. Here's an examp
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>appassembler-maven-plugin</artifactId> <artifactId>maven-dependency-plugin</artifactId>
<version>1.1.1</version> <version>2.4</version>
<executions> <executions>
<execution> <execution>
<id>copy-dependencies</id>
<phase>package</phase> <phase>package</phase>
<goals><goal>assemble</goal></goals> <goals><goal>copy-dependencies</goal></goals>
<configuration>
<assembleDirectory>target</assembleDirectory>
<programs>
<program>
<mainClass>HelloWorld</mainClass>
<name>webapp</name>
</program>
</programs>
</configuration>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
Expand Down Expand Up @@ -154,13 +146,15 @@ On Mac & Linux:


:::term :::term
$ export PORT=5000 $ export PORT=5000
$ sh target/bin/webapp $ java -cp target/classes:"target/dependency/*" HelloWorld

(double quotes needed to prevent expansion of '*')


On Windows: On Windows:


:::term :::term
$ set PORT=5000 $ set PORT=5000
$ target\bin\webapp.bat $ java -cp target\classes:"target\dependency\*" HelloWorld


You should now see something similar to: You should now see something similar to:


Expand All @@ -180,8 +174,9 @@ To run your web process on Heroku, you need to declare what command to use. We'
Here's what the `Procfile` looks like: Here's what the `Procfile` looks like:


:::term :::term
web: sh target/bin/webapp web: java -cp target/classes:target/dependency/* HelloWorld


(note: no double quotes needed in Procfile)


## Store Your App in Git ## Store Your App in Git


Expand Down Expand Up @@ -241,14 +236,14 @@ Now, let's check the state of the app's processes:
$ heroku ps $ heroku ps
Process State Command Process State Command
------------ ------------------ ------------------------------ ------------ ------------------ ------------------------------
web.1 up for 10s sh target/bin/webapp web.1 up for 10s java -cp target/classes:target


The web process is up. Review the logs for more information: The web process is up. Review the logs for more information:


:::term :::term
$ heroku logs $ heroku logs
... ...
2011-08-18T05:30:55+00:00 heroku[web.1]: Starting process with command `java -Xmx384m -Xss256k -XX:+UseCompressedOops -classpath target/classes:"target/dependency/*" HelloWorld` 2011-08-18T05:30:55+00:00 heroku[web.1]: Starting process with command `java -Xmx384m -Xss256k -XX:+UseCompressedOops -cp target/classes:target/dependency/* HelloWorld`
2011-08-18T05:30:56+00:00 app[web.1]: 2011-08-18 05:30:56.310:INFO::jetty-7.4.5.v20110725 2011-08-18T05:30:56+00:00 app[web.1]: 2011-08-18 05:30:56.310:INFO::jetty-7.4.5.v20110725
2011-08-18T05:30:56+00:00 app[web.1]: 2011-08-18 05:30:56.353:INFO::started o.e.j.s.ServletContextHandler{/,null} 2011-08-18T05:30:56+00:00 app[web.1]: 2011-08-18 05:30:56.353:INFO::started o.e.j.s.ServletContextHandler{/,null}
2011-08-18T05:30:56+00:00 app[web.1]: 2011-08-18 05:30:56.389:INFO::Started SelectChannelConnector@0.0.0.0:22464 STARTING 2011-08-18T05:30:56+00:00 app[web.1]: 2011-08-18 05:30:56.389:INFO::Started SelectChannelConnector@0.0.0.0:22464 STARTING
Expand Down
20 changes: 6 additions & 14 deletions pom.xml
Expand Up @@ -10,7 +10,7 @@
<dependency> <dependency>
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId> <artifactId>jetty-servlet</artifactId>
<version>7.4.5.v20110725</version> <version>7.6.0.v20120127</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>
Expand All @@ -21,22 +21,14 @@
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>appassembler-maven-plugin</artifactId> <artifactId>maven-dependency-plugin</artifactId>
<version>1.1.1</version> <version>2.4</version>
<executions> <executions>
<execution> <execution>
<id>copy-dependencies</id>
<phase>package</phase> <phase>package</phase>
<goals><goal>assemble</goal></goals> <goals><goal>copy-dependencies</goal></goals>
<configuration>
<assembleDirectory>target</assembleDirectory>
<programs>
<program>
<mainClass>HelloWorld</mainClass>
<name>webapp</name>
</program>
</programs>
</configuration>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
Expand Down

0 comments on commit c763041

Please sign in to comment.