34
Project Management and Automation Using Maven and Grunt to accelerate development Matthew Hanlon • SEA Conference • April 7, 2014 TEXAS ADVANCED COMPUTING CENTER Powering Discoveries that Change the World

Project Management and Automation: Using Maven and Grunt to accelerate development

Embed Size (px)

DESCRIPTION

My presentation slides from the UCAR Software Engineering Assembly Conference April 7, 2014. Original Reveal.js slides here: https://mrhanlon.com/slides/sea2014

Citation preview

Page 1: Project Management and Automation: Using Maven and Grunt to accelerate development

Project Management and AutomationUsing Maven and Grunt to accelerate development

Matthew Hanlon • SEA Conference • April 7, 2014

TEXAS ADVANCED COMPUTING CENTERPowering Discoveries that Change the World

Page 2: Project Management and Automation: Using Maven and Grunt to accelerate development

Introduction

Page 3: Project Management and Automation: Using Maven and Grunt to accelerate development

Web and MobileApplications

Page 4: Project Management and Automation: Using Maven and Grunt to accelerate development

Building tools and applications to makescientists more productive.7 Developers (and hiring!)

10+ projects

Page 5: Project Management and Automation: Using Maven and Grunt to accelerate development

LiferayJavaScript

Spring

Restlets

JSRPHPJava

Drupal

PortletsSQL

JSONXMLjQuery

MySQL Nodejs

PostgreSQL

NoSQLCakePHP

MongoDB

Python

CodeIgniter

CouchDB

DjangoRESTSOAP

Web services

[ made with: ]https://www.jasondavies.com/wordcloud/

Page 6: Project Management and Automation: Using Maven and Grunt to accelerate development

Without process

Page 7: Project Management and Automation: Using Maven and Grunt to accelerate development

Boring

Page 8: Project Management and Automation: Using Maven and Grunt to accelerate development

What's the big deal?

Page 9: Project Management and Automation: Using Maven and Grunt to accelerate development

Too many results in published scientificpapers are not reproducible

The data is unavailableThe environment no longer existsThe code is broken!

Page 10: Project Management and Automation: Using Maven and Grunt to accelerate development

Reproducibility in Computer Science

That's only a 20%

success rate!

[ source: ]http://reproducibility.cs.arizona.edu/

Page 11: Project Management and Automation: Using Maven and Grunt to accelerate development

Why doesn't the code build?Missing dependenciesMysterious configuration parametersCompile errorsAnd of course, there is no documentation

Page 12: Project Management and Automation: Using Maven and Grunt to accelerate development

How can we fix that?Automate the boring stuffMake the rest worth it

Page 13: Project Management and Automation: Using Maven and Grunt to accelerate development

Tools for automationand process

Apache MavenGrunt.jsBowerSass/CompassDoxygen

Page 14: Project Management and Automation: Using Maven and Grunt to accelerate development

MavenManaging project build, reporting, and documentation.

Page 15: Project Management and Automation: Using Maven and Grunt to accelerate development

POM.xmlThe Project Object Model

Projectinformation

Name, version, URL, developers, contributors, licensing,organization

Build settings Build process, dependencies, non-code resource handling,reporting

Environmentsettings

Source control, repositories, distribution, issuemanagement

Page 16: Project Management and Automation: Using Maven and Grunt to accelerate development

PluginsBasics: Compiler, Resources, JavaDocs, Eclipse, IntelliJ IDEAAdvanced: Exec, SiteCommunity: Doxygen, Liferay, Jetty

Page 17: Project Management and Automation: Using Maven and Grunt to accelerate development

<?xml version="1.0" encoding="UTF-8"?><project> <modelVersion>4.0.0</modelVersion> <groupId>com.github.mrhanlon</groupId> <artifactId>sea2014-demo</artifactId> <version>1.0-SNAPSHOT</version> <packaging>war</packaging> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> <version>${spring.version}</version> <type>jar</type> <scope>compile</scope> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>${spring.version}</version> <type>jar</type> <scope>test</scope> </dependency> <dependency> <groupId>cglib</groupId> <artifactId>cglib-nodep</artifactId> <version>${cglib.version}</version> <scope>runtime</scope> </dependency> <dependency> <groupId>javax.servlet</groupId>

Page 18: Project Management and Automation: Using Maven and Grunt to accelerate development

$ mvn install[INFO] Scanning for projects...[INFO][INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder [INFO][INFO] ------------------------------------------------------------------------[INFO] Building module1 1.0-SNAPSHOT[INFO] ------------------------------------------------------------------------[INFO][INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ module1 ---[INFO] Deleting /Users/mrhanlon/workspace/github/mrhanlon/sea2014-demo/module1/target[INFO][INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ module1 ---[INFO] Using 'UTF-8' encoding to copy filtered resources.[INFO] skip non existing resourceDirectory /Users/mrhanlon/workspace/github/mrhanlon/sea2014-demo/module1/src/main/resources[INFO]

[INFO] --- maven-compiler-plugin:2.0.2:compile (default-compile) @ module1 ---[INFO] Compiling 1 source file to /Users/mrhanlon/workspace/github/mrhanlon/sea2014-demo/module1/target/classes[INFO][INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ module1 ---[INFO] Using 'UTF-8' encoding to copy filtered resources.[INFO] skip non existing resourceDirectory /Users/mrhanlon/workspace/github/mrhanlon/sea2014-demo/module1/src/test/resources[INFO][INFO] --- maven-compiler-plugin:2.0.2:testCompile (default-testCompile) @ module1 ---[INFO] Compiling 1 source file to /Users/mrhanlon/workspace/github/mrhanlon/sea2014-demo/module1/target/test[INFO][INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ module1 ---[INFO] Surefire report directory: /Users/mrhanlon/workspace/github/mrhanlon/sea2014-demo/module1/target/surefire

------------------------------------------------------- T E S T S-------------------------------------------------------Running com.github.mrhanlon.AppTestTests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.035 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

Page 19: Project Management and Automation: Using Maven and Grunt to accelerate development

GruntThe JavaScript Task Runner

(It's not just for JavaScript!)

Page 20: Project Management and Automation: Using Maven and Grunt to accelerate development

Gruntfile.jsDeclarative JSON/JavaScript configuration file

Executes tasks in Node.js runtimeLoads of community plugins:

jslint/jshintfile taskswatchcompasslibrary/framework support

Page 21: Project Management and Automation: Using Maven and Grunt to accelerate development

'use strict';

module.exports = function(grunt) {

// Project configuration. grunt.initConfig({ // Metadata. pkg: grunt.file.readJSON('tiny-pubsub.jquery.json'), banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + '<%= grunt.template.today("yyyy-mm-dd") %>\n' + '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' + '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' + ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n', // Task configuration. clean: { src: ['dist'] }, concat: { options: { banner: '<%= banner %>', stripBanners: true }, dist: { src: ['src/<%= pkg.name %>.js'], dest: 'dist/ba-<%= pkg.name %>.js' }, }, uglify: { options: { banner: '<%= banner %>' }, dist: { src: '<%= concat.dist.dest %>', dest: 'dist/ba-<%= pkg.name %>.min.js' }, }, qunit: { files: ['test/**/*.html'] }, jshint: {

Page 22: Project Management and Automation: Using Maven and Grunt to accelerate development

$ gruntRunning "jshint:gruntfile" (jshint) task>> 1 file lint free.

Running "jshint:src" (jshint) task>> 1 file lint free.

Running "jshint:test" (jshint) task>> 1 file lint free.

Running "qunit:files" (qunit) taskTesting test/tiny-pubsub.html....OK>> 4 assertions passed (23ms)

Running "clean:files" (clean) taskCleaning "dist"...OK

Running "concat:dist" (concat) taskFile "dist/ba-tiny-pubsub.js" created.

Running "uglify:dist" (uglify) taskFile "dist/ba-tiny-pubsub.min.js" created.Uncompressed size: 389 bytes.Compressed size: 119 bytes gzipped (185 bytes minified).

Done, without errors.

$_

Page 23: Project Management and Automation: Using Maven and Grunt to accelerate development

BowerFront-end package management

package agnostic

runs over git

Page 24: Project Management and Automation: Using Maven and Grunt to accelerate development

Declarative JSON configuration{ "name": "vislab-reservation-portlet", "version": "1.0.0", "dependencies": { "modernizr": "~2.6.2", "jqueryui-timepicker-addon": "1.4.3", "mustache": "~0.8.1", "datejs": "*", "fullcalendar": "~1.6.4" }}

Page 25: Project Management and Automation: Using Maven and Grunt to accelerate development

Sass/Compass"Expressive" CSS

Page 26: Project Management and Automation: Using Maven and Grunt to accelerate development

@mixin box-sizing($bs) { $bs: unquote($bs); @include experimental(box-sizing, $bs, -moz, -webkit, not -o, not -ms, not -khtml, official );}

* { @include box-sizing(border-box);}

.alert { border: 1px solid black;}

.alert-error { @extend .alert; color: red; border-color: red;}

Page 27: Project Management and Automation: Using Maven and Grunt to accelerate development

DoxygenGenerating documentation for annotated sources

Tons of language supportExtensions for other languages

(like JavaScript!)

Page 28: Project Management and Automation: Using Maven and Grunt to accelerate development

Demo

Page 29: Project Management and Automation: Using Maven and Grunt to accelerate development

So what's next?

Page 30: Project Management and Automation: Using Maven and Grunt to accelerate development

Get up and running in minutes$> git clone <repo url> my-dev-env$> cd my-dev-env$> git submodule init$> git submodule update$> mvn install$> mvn liferay:deploy

Page 31: Project Management and Automation: Using Maven and Grunt to accelerate development
Page 32: Project Management and Automation: Using Maven and Grunt to accelerate development

The Second Law of ThermodynamicsThe entropy of an isolated system never decreases,

because isolated systems always evolve towardthermodynamic equilibrium a state with maximum

entropy.

Page 33: Project Management and Automation: Using Maven and Grunt to accelerate development