Created
January 30, 2014 00:08
-
-
Save skhatri/8699973 to your computer and use it in GitHub Desktop.
Grunt create war file using compress and rename.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = { | |
build: 'build', | |
root: '', | |
dist: 'build/dist' | |
}; | |
grunt.initConfig({ | |
app: app, | |
//create a war file in zip format. compress does not support it currently. | |
compress: { | |
war: { | |
options: { | |
archive: '<%=app.build%>/app.war.zip' | |
}, | |
files: [ | |
{expand: true, cwd: '<%=app.root%>', src: ['WEB-INF/web.xml'], dest: ''}, | |
{expand: true, cwd: '<%=app.dist%>', src: ['**/*'], dest: ''} | |
] | |
} | |
}, | |
//rename war.zip to war | |
rename: { | |
war: { | |
files: [ | |
{src: ['<%=app.build%>/app.war.zip'], dest: '<%=app.build%>/app.war'} | |
] | |
} | |
} | |
}); | |
grunt.loadNpmTasks('grunt-contrib-compress'); | |
grunt.loadNpmTasks('grunt-contrib-rename'); | |
grunt.registerTask('war', ['compress:war', 'rename:war']); | |
//run grunt war |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment