Я довольно новичок в использовании инструментов внешнего интерфейса, таких как grunt, bower и т. Д. В настоящее время я работаю над проектом, который использует angular для внешнего интерфейса и JavaEE для внутреннего интерфейса.Файл войны генерируется с помощью Maven.Я использую exec-maven-plugin для вызова node.js, bower и grunt.Когда я запускаю maven для создания артефакта, все работает нормально и генерирует файл войны.Проблема в том, что веб-интерфейс не работает в браузере.Когда я использую grunt для генерации всех этих интерфейсов, никаких ошибок / предупреждений не произойдет / не произойдет.Также подробный переключатель grunt build не предлагает никаких ошибок / предупреждений.В конце браузер «говорит», что jquery, angular и т. Д. Не найдены.
Более широкие сообщения об ошибках
// Gruntfile.js
'use strict';
module.exports = function (grunt) {
require('time-grunt')(grunt);
require('jit-grunt')(grunt, {
useminPrepare: 'grunt-usemin',
ngtemplates: 'grunt-angular-templates',
cdnify: 'grunt-google-cdn'
});
var appConfig = {
app: require('./bower.json').appPath || 'app',
dist: '../target/generated-sources'
};
grunt.loadNpmTasks('grunt-ng-constant');
grunt.loadNpmTasks("grunt-bower-install-simple");
grunt.initConfig({
yeoman: appConfig,
ngconstant: {
options: {
space: ' ',
wrap: '"use strict";\n\n {%= __ngModule %}',
name: 'the_app.config',
dest: '<%= yeoman.app %>/enviroment/config.js'
},
development: {
constants: {
ENV: {
name: 'development',
appName: 'the_app',
hostEndpoint: 'http://localhost:8080/the_app/'
}
}
},
deployment: {
constants: {
ENV: {
name: 'deployment',
appName: 'the_app'
}
}
},
},
"bower-install-simple": {
options: {
directory: 'lib',
color: true,
interactive: false
},
"dev": {
options: {
production: false
}
},
"prod": {
options: {
production: true
}
}
},
watch: {
bower: {
files: ['bower.json'],
tasks: ['wiredep']
},
js: {
files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
tasks: ['newer:jshint:all'],
options: {
livereload: '<%= connect.options.livereload %>'
}
},
jsTest: {
files: ['test/spec/{,*/}*.js'],
tasks: ['newer:jshint:test', 'karma']
},
compass: {
files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
tasks: ['compass:server', 'autoprefixer:server']
},
gruntfile: {
files: ['Gruntfile.js'],
tasks: ['ngconstant:development']
},
livereload: {
options: {
livereload: '<%= connect.options.livereload %>'
},
files: [
'<%= yeoman.app %>/{,*/}*.html',
'.tmp/styles/{,*/}*.css',
'<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
]
}
},
connect: {
options: {
port: 9000,
hostname: 'localhost',
livereload: 35729
},
livereload: {
options: {
open: true,
middleware: function (connect) {
return [
connect.static('.tmp'),
connect().use('/lib', connect.static('./lib')),
connect().use('/app/styles', connect.static('./app/styles')),
connect.static(appConfig.app)
];
}
}
},
test: {
options: {
port: 9001,
middleware: function (connect) {
return [
connect.static('.tmp'),
connect.static('test'),
connect().use('/lib',connect.static('./lib')),
connect.static(appConfig.app)
];
}
}
},
dist: {
options: {
open: true,
base: '<%= yeoman.dist %>'
}
}
},
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
},
all: {
src: [
'Gruntfile.js',
'<%= yeoman.app %>/scripts/{,*/}*.js'
]
},
test: {
options: {
jshintrc: 'test/.jshintrc'
},
src: ['test/spec/{,*/}*.js']
}
},
clean: {
dist: {
files: [{
dot: true,
src: [
'.tmp',
'<%= yeoman.dist %>/{,*/}*',
'!<%= yeoman.dist %>/.git{,*/}*'
]
}]
},
server: '.tmp'
},
autoprefixer: {
options: {
browsers: ['last 1 version']
},
server: {
options: {
map: true,
},
files: [{
expand: true,
cwd: '.tmp/styles/',
src: '{,*/}*.css',
dest: '.tmp/styles/'
}]
},
dist: {
files: [{
expand: true,
cwd: '.tmp/styles/',
src: '{,*/}*.css',
dest: '.tmp/styles/'
}]
}
},
wiredep: {
app: {
src: ['<%= yeoman.app %>/index.html'],
ignorePath: /\.\.\//
},
test: {
devDependencies: true,
src: '<%= karma.unit.configFile %>',
ignorePath: /\.\.\//,
fileTypes:{
js: {
block: /(([\s\t]*)\/{2}\s*?bower:\s*?(\S*))(\n|\r|.)*?(\/{2}\s*endbower)/gi,
detect: {
js: /'(.*\.js)'/gi
},
replace: {
js: '\'{{filePath}}\','
}
}
}
},
sass: {
src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
ignorePath: /(\.\.\/){1,2}lib\//
}
},
compass: {
options: {
sassDir: '<%= yeoman.app %>/styles',
cssDir: '.tmp/styles',
generatedImagesDir: '.tmp/images',
imagesDir: '<%= yeoman.app %>/images',
javascriptsDir: '<%= yeoman.app %>',
fontsDir: '<%= yeoman.app %>/fonts',
importPath: './lib',
httpImagesPath: '/images',
httpGeneratedImagesPath: '/images',
httpFontsPath: '/fonts',
relativeAssets: false,
assetCacheBuster: false,
raw: 'Sass::Script::Number.precision = 10\n'
},
dist: {
options: {
generatedImagesDir: '<%= yeoman.dist %>/images',
httpGeneratedImagesPath: '/the_app/images',
httpFontsPath: '/the_app/fonts',
outputStyle: 'compressed',
debugInfo: false,
noLineComments: true
}
},
server: {
options: {
sourcemap: true
}
}
},
filerev: {
dist: {
src: [
'<%= yeoman.dist %>/scripts/{,*/}*.js',
'<%= yeoman.dist %>/styles/{,*/}*.css',
'<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
'<%= yeoman.dist %>/styles/fonts/*'
]
}
},
useminPrepare: {
html: '<%= yeoman.app %>/index.html',
options: {
dest: '<%= yeoman.dist %>',
flow: {
html: {
steps: {
js: ['concat', 'uglifyjs'],
css: ['cssmin']
},
post: {}
}
}
}
},
usemin: {
html: ['<%= yeoman.dist %>/{,*/}*.html'],
css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
js: ['<%= yeoman.dist %>/scripts/{,*/}*.js'],
options: {
assetsDirs: [
'<%= yeoman.dist %>',
'<%= yeoman.dist %>/images',
'<%= yeoman.dist %>/styles'
],
patterns: {
js: [[/(images\/[^''""]*\.(png|jpg|jpeg|gif|webp|svg))/g, 'Replacing references to images']]
}
}
},
uglify: {
onlyScripts: {
files: [{
dest: '<%= yeoman.dist %>/scripts/scripts.js',
src: ['.tmp/concat/scripts/scripts.js']
}]
}
},
imagemin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/images',
src: '{,*/}*.{png,jpg,jpeg,gif}',
dest: '<%= yeoman.dist %>/images'
}]
}
},
svgmin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/images',
src: '{,*/}*.svg',
dest: '<%= yeoman.dist %>/images'
}]
}
},
htmlmin: {
dist: {
options: {
collapseWhitespace: true,
conservativeCollapse: true,
collapseBooleanAttributes: true,
removeCommentsFromCDATA: true
},
files: [{
expand: true,
cwd: '<%= yeoman.dist %>',
src: ['*.html'],
dest: '<%= yeoman.dist %>'
}]
}
},
ngtemplates: {
dist: {
options: {
module: 'the_app',
htmlmin: '<%= htmlmin.dist.options %>',
usemin: 'scripts/scripts.js'
},
cwd: '<%= yeoman.app %>',
src: 'modules/**/*.html',
dest: '.tmp/templateCache.js'
}
},
ngAnnotate: {
dist: {
files: [{
expand: true,
cwd: '.tmp/concat/scripts',
src: '*.js',
dest: '.tmp/concat/scripts'
}]
}
},
copy: {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>',
dest: '<%= yeoman.dist %>',
src: [
'*.{ico,png,txt}',
'.htaccess',
'*.html',
'lib/font-awesome/css/*',
'lib/font-awesome/fonts/*',
'lib/pixeden-stroke-7-icon/pe-icon-7-stroke/fonts/*',
'fonts/**/*',
'images/**/*',
'styles/fonts/{,*/}*.*',
'language/{,*/}*.*'
]
}, {
expand: true,
cwd: '.tmp/images',
dest: '<%= yeoman.dist %>/images',
src: ['generated/*']
}, {
expand: true,
cwd: '.',
src: 'lib/bootstrap-sass-official/assets/fonts/bootstrap/*',
dest: '<%= yeoman.dist %>'
},{
expand: true,
cwd: '.',
src: 'lib/font-awesome/css/*',
dest: '<%= yeoman.dist %>'
}, {
expand: true,
cwd: 'lib/font-awesome/',
src: 'fonts/*',
dest: '<%= yeoman.dist %>'
}, {
expand: true,
cwd: 'lib/pixeden-stroke-7-icon/pe-icon-7-stroke/',
src: 'fonts/*',
dest: '<%= yeoman.dist %>'
}, {
expand: true,
cwd: 'lib/flag-icon-css/',
src: 'flags/**/*',
dest: '<%= yeoman.dist %>'
}]
},
styles: {
expand: true,
cwd: '<%= yeoman.app %>/styles',
dest: '.tmp/styles/',
src: '{,*/}*.css'
},
images: {
expand: true,
cwd: '<%= yeoman.app %>/images',
dest: '<%= yeoman.dist %>/images',
src: '{,*/}*.*'
},
vendors: {
expand: true,
cwd: '.tmp/concat/scripts/',
dest: '<%= yeoman.dist %>/scripts/',
src: ['vendor.js', 'modernizr.custom.js', 'vendor.codemirror.js'],
}
},
concurrent: {
server: [
'compass:server'
],
test: [
'compass'
],
dist: [
'compass:dist'
]
},
karma: {
unit: {
configFile: 'test/karma.conf.js',
singleRun: true
}
}
});
grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
if (target === 'dist') {
return grunt.task.run(['build', 'connect:dist:keepalive']);
}
grunt.task.run([
'clean:server',
'ngconstant:development',
'wiredep',
'concurrent:server',
'autoprefixer:server',
'connect:livereload',
'watch'
]);
});
grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function (target) {
grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
grunt.task.run(['serve:' + target]);
});
grunt.registerTask('test', [
'clean:server',
'ngconstant:deployment',
'wiredep',
'concurrent:test',
'autoprefixer',
'connect:test',
'karma'
]);
grunt.registerTask('build', [
'clean:dist',
'ngconstant:deployment',
'wiredep',
'useminPrepare',
'concurrent:dist',
'autoprefixer',
'ngtemplates',
'concat',
'ngAnnotate',
'copy:dist',
'cssmin',
'uglify:onlyScripts',
'copy:vendors',
'filerev',
'copy:images',
'usemin',
'htmlmin'
]);
grunt.registerTask('default', [
'newer:jshint',
'test',
'build'
]);
};
// package.json
{
"name": "asDemo",
"private": true,
"devDependencies": {
"ember-cli-font-awesome": "^1.4.2",
"grunt": "^0.4.5",
"grunt-angular-templates": "^0.5.7",
"grunt-autoprefixer": "^2.0.0",
"grunt-bower-install-simple": "~1.1.4",
"grunt-concurrent": "^1.0.0",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-compass": "^1.1.1",
"grunt-contrib-concat": "^0.5.0",
"grunt-contrib-connect": "^0.9.0",
"grunt-contrib-copy": "^0.7.0",
"grunt-contrib-cssmin": "^0.12.3",
"grunt-contrib-htmlmin": "^0.4.0",
"grunt-contrib-imagemin": "^0.9.2",
"grunt-contrib-jshint": "^0.11.0",
"grunt-contrib-uglify": "^0.7.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-filerev": "^2.1.2",
"grunt-google-cdn": "^0.4.3",
"grunt-karma": "^3.0.2",
"grunt-newer": "^1.1.0",
"grunt-ng-annotate": "^0.9.2",
"grunt-ng-constant": "^1.1.0",
"grunt-svgmin": "^2.0.0",
"grunt-upload-file": "0.0.2",
"grunt-usemin": "^3.0.0",
"grunt-wiredep": "^2.0.0",
"jit-grunt": "^0.9.1",
"jshint-stylish": "^1.0.0",
"karma-jasmine": "^0.3.6",
"karma-phantomjs-launcher": "^0.2.1",
"time-grunt": "^1.0.0"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "grunt test"
},
"dependencies": {
"karma": "^4.3.0"
}
}
Я ожидаю, чтоФронтенд имеет все необходимые библиотеки, но браузер не находит jquery, угловой и т. д.