Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions build_windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/bin/bash

# Author: Didier DONSEZ
# License ASL 2.0

# Build script for the Wildfly container containing javaee7-angular simple web app and swagger UI

COMPONENT_VERSION="1.0"
COMPONENT_NAME="wildfly-app"
COMPONENT_INSTANCE=1
# DOCKERFILE=${COMPONENT_NAME}.df
DOCKERFILE=Dockerfile

WORKDIR=$(pwd)

wait_for_host_port(){
echo "Wait for $1:$2 ..."
until nc -vzw 2 $1 $2 &>/dev/null;
do
echo "Wait for $1:$2"
sleep 1
done
echo "$1:$2 ready"
}

# Install Docker
# TODO

# Install Java and Maven
# TODO

# Get javaee7-angular
mkdir tmp1
cd tmp1
git clone https://github.com/radcortez/javaee7-angular.git
cd javaee7-angular
mvn clean install
cd ../..

# Get swagger-ui
mkdir tmp2
cd tmp2
git clone https://github.com/swagger-api/swagger-ui.git
cd swagger-ui

cd $WORKDIR

cp tmp1/javaee7-angular/target/javaee7-angular.war .
mkdir swagger-ui
cp -r tmp2/swagger-ui/dist/* swagger-ui/

docker pull jboss/wildfly
docker build -t ${COMPONENT_NAME}-${COMPONENT_INSTANCE}:${COMPONENT_VERSION} -f $DOCKERFILE .

docker run --hostname ${COMPONENT_NAME}-${COMPONENT_INSTANCE} --name ${COMPONENT_NAME}-${COMPONENT_INSTANCE} -p 8080:8080 -p 9990:9990 -d ${COMPONENT_NAME}-${COMPONENT_INSTANCE}:${COMPONENT_VERSION}


# Open URLs
wait_for_host_port localhost 8080
open http://localhost:8080/

open http://localhost:8080/javaee7-angular

# wait_for_host_port localhost 8443
open https://localhost:8443/javaee7-angular

# wait_for_host_port localhost 9990
open http://localhost:9990/management
3 changes: 3 additions & 0 deletions javaee7-angular/.bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory": "src/main/webapp/lib/bower"
}
160 changes: 160 additions & 0 deletions javaee7-angular/Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
'use strict';

module.exports = function (grunt) {

// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);

/*
* Time how long grunt tasks take to run, this might be important when having complex builds that take forever.
* For now just to show how fancy grunt is.
*/
require('time-grunt')(grunt);

// init required configurations for each task.
grunt.initConfig({

// Project settings
config: {
path: {
webapp: {
root: 'src/main/webapp'
},
temp: {
root: 'temp'
},
build: {
root: 'build'
}
}
},

// From grunt-contrib-clean
clean: {
build: [
'<%= config.path.temp.root %>',
'<%= config.path.build.root %>'
]
},

// From grunt-bower-install-simple. Downloads the web dependencies.
"bower-install-simple": {
options: {
color: true
},
"prod": {
options: {
production: true
}
},
"dev": {
options: {
production: false
}
}
},

// From grunt-wiredep. Automatically inject Bower components into the HTML file
wiredep: {
target: {
src: '<%= config.path.webapp.root %>/index.html',
ignorePath: '<%= config.path.webapp.root %>'
}
},

// From grunt-contrib-concat. This is usefull when we have more than one css file, not the case now...
/*
concat: {
styles: {
src: [
'<%= config.path.webapp.root %>/css/style.css',
],
dest: '<%= config.path.temp.root %>/concat/css/application.css'
}
},
*/

// From grunt-contrib-copy. Copies remaining files to places other tasks can use
copy: {
build: {
files: [
{
src: '<%= config.path.webapp.root %>/index.html',
dest: '<%= config.path.build.root %>/index.html'
}
]
}
},

// From grunt-contrib-htmlmin. Minifies index.html file.
htmlmin: {
prod: {
options: {
collapseBooleanAttributes: true,
collapseWhitespace: true,
removeComments: true,
removeCommentsFromCDATA: true,
removeEmptyAttributes: true,
removeOptionalTags: true,
removeRedundantAttributes: true,
useShortDoctype: true
},
files: [
{
expand: true,
cwd: '<%= config.path.build.root %>',
src: ['index.html'],
dest: '<%= config.path.build.root %>'
}
]
}
},

// From grunt-usemin. Reads HTML for usemin blocks to enable smart builds
useminPrepare: {
html: '<%= config.path.webapp.root %>/index.html',
options: {
staging: '<%= config.path.temp.root %>',
root: '<%= config.path.webapp.root %>',
dest: '<%= config.path.build.root %>'
}
},

// From grunt-usemin.
usemin: {
html: '<%= config.path.build.root %>/index.html'
},

// From grunt-contrib-uglify.
uglify: {
options: {
mangle: false
}
}
}
);

// Task: Build production version ready for deployment
grunt.registerTask('install', [
'clean:build',
'bower-install-simple',
//'concat:styles',
'wiredep',
'useminPrepare',
'concat:generated',
'cssmin',
'uglify',
'copy:build',
'usemin',
'htmlmin'
]);

grunt.registerTask('process-resources', [
'bower-install-simple',
'wiredep',
]);

grunt.registerTask('default', [
'install'
]);
};
20 changes: 20 additions & 0 deletions javaee7-angular/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright (c) 2014 Roberto Cortez

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
75 changes: 75 additions & 0 deletions javaee7-angular/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Java EE 7 - Angular - Sample Application #

## Blog posts ##

* [Java EE 7 with Angular JS – Part 1](http://www.radcortez.com/java-ee-7-with-angular-js-part-1)

* [Java EE 7 with Angular JS – CRUD, REST, Validations – Part 2](http://www.radcortez.com/java-ee-7-with-angular-js-crud-rest-validations-part-2)

* [Codenvy setup to demo applications using Docker: Java EE 7 with Angular](http://www.radcortez.com/codenvy-setup-to-demo-applications-using-docker-java-ee-7-with-angular/)

## How to run ? ##

## Codenvy ##

Codenvy (https://codenvy.com) is a cloud environment for coding, building, and debugging apps. It's the recommended way
to run this project, since all the setup is cloud based, you don't need to setup anything in your own machine.

Just go to: [Java EE 7 with Angular Demo](https://codenvy.com/f?id=ybnr6nsyrimeoyhg)

Wait for the project to load and then just hit the Green Run Button in the upper right corner. You might want to check a
few instructions here: [Codenvy setup to demo applications using Docker: Java EE 7 with Angular](http://www.radcortez.com/codenvy-setup-to-demo-applications-using-docker-java-ee-7-with-angular/)

## Localhost ##

* You need JDK 7 or higher, Maven 3 and Wildfly 8 or Glassfish 4.1 to run the application.
* Build the code using Maven with the command: `mvn clean install`.

### Deploy in Wildfly 10 ###

* Copy the file javaee7-angular.war from target directory to your Wildfly installation folder
`standalone/deployments`

* You can also deploy the app using the Maven Wildfly Plugin with the following command: `mvn wildfly:deploy`. You need to have Wildfly running.

* Start Wildfly and go to http://localhost:8080/javaee7-angular/ (http://localhost:8080/javaee7-angular/)

### Deploy in Embedded Wilffy ###

* Just run `mvn wildfly:run`

* Go to http://localhost:8080/javaee7-angular/ (http://localhost:8080/javaee7-angular/)

### Deploy in Glassfish 4.1 ###

* Open Admin Console (http://localhost:8484/)

* Go to menu "Application"

* In the button "Deploy..." select the file javaee7-angular.war

* Go to http://localhost:8080/javaee7-angular/ (http://localhost:8080/javaee7-angular/)

### Deploy in Embedded-Glassfish 4.1 ###

* Just run `mvn embedded-glassfish:run`

* Go to http://localhost:8080/javaee7-angular/ (http://localhost:8080/javaee7-angular/)

### Run with TomEE ###

* Just run `mvn tomee:run`

* Go to http://localhost:8080/javaee7-angular/ (http://localhost:8080/javaee7-angular/)

## Javascript Package Management (optional) ##

The required JS libraries are included in the project, but it also possible to manage them following the next steps:

* You need NPM. Please go to http://nodejs.org/download/ to get a copy.

* Once NPM is installed run the command `npm install`.

* Install Grunt `npm install -g grunt-cli` for more information please go to http://gruntjs.com/getting-started.

* Run the command 'grunt' to download all the web dependencies and build an optimized version of the project.
18 changes: 18 additions & 0 deletions javaee7-angular/bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "javaee7-angular",
"version": "1.0.0",
"authors": [
"Roberto Cortez <[email protected]>",
"Paulo Grácio <[email protected]>"
],
"description": "javaee7-angular JavaScript dependencies.",
"private": true,
"dependencies": {
"angular": "~1.5.6",
"angular-resource": "~1.5.6",
"jquery": "~2.1.0",
"angular-bootstrap": "~0.11.0",
"bootstrap-css-only": "3.2.0",
"angular-grid": "~2.0.11"
}
}
27 changes: 27 additions & 0 deletions javaee7-angular/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "javaee7-angular",
"version": "1.0.0",
"authors": [
"Roberto Cortez <[email protected]>",
"Paulo Grácio <[email protected]>"
],
"description": "javaee7-angular dependencies for Grunt.",
"private": true,
"devDependencies": {
"grunt": "~1.0.0",
"load-grunt-tasks": "~3.5.0",
"time-grunt": "~1.3.0",
"grunt-contrib-clean": "~1.0.0",
"grunt-wiredep": "~3.0.1",
"grunt-contrib-htmlmin": "~1.4.0",
"grunt-usemin": "~3.1.1",
"grunt-contrib-copy": "~1.0.0",
"grunt-contrib-concat": "~1.0.1",
"grunt-contrib-uglify": "~1.0.1",
"grunt-contrib-cssmin": "~1.0.1",
"grunt-bower-install-simple": "~1.2.3"
},
"engines": {
"node": ">=0.8.0"
}
}
Loading