I know that it is possible to include AngularJs with Maven into a Spring project for instance but how would one include it with Gradle?
Looking into gradle repositor
It may be late, but checkout https://github.com/gharia/spring-boot-angular. This is Spring Boot project with angular JS using asset-pipeline.
EDIT:
Using this gradle plugin, we can easily manage the client side dependencies, either of npm or bower or GIT. Please see the sample build.gradle below, in which I have included several dependencies of Angular in clientDependencies.
buildscript {
repositories {
mavenCentral()
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.3.RELEASE")
classpath("org.codehaus.groovy:groovy:2.4.6")
classpath("gradle.plugin.com.boxfuse.client:flyway-release:4.0")
}
}
plugins {
id 'com.craigburke.client-dependencies' version '1.0.0-RC2'
}
apply plugin: 'groovy'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'war'
jar {
baseName = 'boot-demo'
version = '0.1.0'
}
repositories {
mavenCentral()
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
jcenter()
maven { url "http://repo.spring.io/libs-snapshot" }
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
configurations {
providedRuntime
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")
compile("org.springframework.boot:spring-boot-starter-actuator")
compile("org.springframework.boot:spring-boot-starter-data-jpa")
compile("org.codehaus.groovy:groovy")
testCompile("org.springframework.boot:spring-boot-starter-test")
testCompile("junit:junit")
}
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
clientDependencies {
npm {
'angular'('1.5.x', into: 'angular') {
include 'angular.js'
include 'angular.min.js'
}
'angular-resource'('1.5.x', into: 'angular') {
include 'angular-resource.js'
include 'angular-resource.min.js'
}
'angular-mocks'('1.5.x', into: 'angular') {
include 'angular-mocks.js'
include 'angular-mocks.min.js'
}
'angular-route'('1.5.x', into: 'angular'){
include 'angular-route.js'
include 'angular-route.min.js'
}
'angular-animate'('1.5.x', into: 'angular') {
include 'angular-animate.js'
include 'angular-animate.min.js'
}
}
}
assets {
minifyJs = true
minifyCss = true
}
Please see the following blog for details of architecture of sample Spring Boot Project with angular.:
https://ghariaonline.wordpress.com/2016/04/19/spring-boot-with-angular-using-gradle/