diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml index 5fe5ee9..c0d5607 100644 --- a/.settings/org.eclipse.wst.common.project.facet.core.xml +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -1,6 +1,5 @@ - diff --git a/README.md b/README.md index f8d4872..5bc2a82 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,22 @@ # project-tron -Cloned from https://github.com/aguibert/coms319-project4 +Publicly hosted on IBM Cloud here: [http://projecttron.mybluemix.net/](http://projecttron.mybluemix.net/) -Original readme.md: +Bluemix toolchain automatically deploys the current `project-tron/project-tron:master` branch -coms319-project4 -================ -## Setup Instructions -1. You will need Eclipse for Java EE developers (normal eclipse won't do) -2. Go to wasdev.net, download the latest beta image and eclipse tooling https://developer.ibm.com/wasdev/downloads/liberty-profile-beta/ - 1. Follow the steps for "Installing with the Eclipse tools beta" to install the tooling - 2. Follow the steps for "Installing from the command line" to install the runtime -3. Once you clone the repository, import existing projects into your workspace -4. Create the server runtime: - 1. In eclipse, File->Server->Runtime Environments->Add... Websphere Application Server Liberty Profile - 2. Next, browse for the location where you extracted your Wepshere runtime, then click Finish -5. In the servers view (select ) -6. Name the server "project4-server" -7. Add the coms319.team10.project4 resource to the server, then click finish. -8. In the "server" tab, you should have created a "project4-server" server, you can start it by selecting it and pressing the green play button in the server tab. \ No newline at end of file +## To run locally + +Builds the webapp, starts liberty server, and deploys app to server. Once app is running, opens web browser + +``` +./gradlew libertyStart openBrowser +``` + +To stop a liberty server, issue the command: + +``` +./gradlew libertyStop +``` +(Note that `libertyRun` and `libertyStart` commands will first invoke `libertyStop`) + +Originally cloned from https://github.com/aguibert/coms319-project4 diff --git a/build.gradle b/build.gradle index 68fe9b6..612b024 100644 --- a/build.gradle +++ b/build.gradle @@ -1,21 +1,54 @@ -// Apply the java plugin to add support for Java -apply plugin: 'java' - -// Apply the war plugin to build a web archive +apply plugin: 'liberty' apply plugin: 'war' sourceCompatibility = 1.8 -// In this section you declare where to find the dependencies of your project +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath 'net.wasdev.wlp.gradle.plugins:liberty-gradle-plugin:2.0.1' + } +} + repositories { - // Use 'jcenter' for resolving your dependencies. - // You can declare any Maven/Ivy/file repository here. - jcenter() + mavenCentral() } -// In this section you declare the dependencies for your production and test code dependencies { - // Java EE compile 'javax:javaee-api:7.0' + libertyRuntime 'io.openliberty:openliberty-runtime:17.0.0.3' +} + +ext { + httpPort = 8080 + httpsPort = 8443 +} + +liberty { + server { + name = 'tronServer' + dropins = [war] + bootstrapProperties = ['httpPort': httpPort, 'httpsPort': httpsPort] + } +} + +libertyStart.dependsOn 'libertyStop' +libertyRun.dependsOn 'libertyStop' + +task openBrowser { + description = 'Opens a web browser to http://localhost:${httpPort}/' + doLast { + java.awt.Desktop.desktop.browse "http://localhost:${httpPort}/".toURI() + } +} + +gradle.taskGraph.whenReady { graph -> + if (graph.hasTask(":libertyStart")) { + libertyStart.doLast { + println ("Application is running on http://localhost:${httpPort}/") + } + } } diff --git a/src/main/liberty/config/server.xml b/src/main/liberty/config/server.xml new file mode 100644 index 0000000..ce237d5 --- /dev/null +++ b/src/main/liberty/config/server.xml @@ -0,0 +1,9 @@ + + + webProfile-7.0 + + + + + + \ No newline at end of file