Closed littlemaneuver closed 9 years ago
I don't understand what you mean with …to make maven.deploy process end syncronously. Streams streams are always asynchron. In planned to remove this callback in the future, because its not very common to do such callbacks with gulp. You could do a cleanup by piping your files into a clean function/plugin
var gulp = require('gulp'),
maven = require('gulp-maven-deploy'),
clean = require('gulp-clean');
gulp.src('./dist', {read: false})
.pipe(maven.deploy(options))
.pipe(clean())
Please have a look at issue #8 and leave a comment if my future plans match your needs…
I ment that it's a good practice that I can see when my gulp task is finished. Without additional callback I get 'Deploing snapshot ...' message and that's all, with additional callback I'm able to see 'task deploy finished at ...'.
gulp.task('deploy-snapshot', ['dist'], function(cb){
gulp.src('./dist/')
.pipe(maven.deploy(config.snapshotConfig, cb));
});
The cb
function in gulp is only necessary for tasks which have some non-stream-async-stuff. If your have a stream, you can easily return it and gulp will mark this task as done when the stream ends.
Try this:
gulp.task('deploy-snapshot', ['dist'], function(){
return gulp.src('./dist/')
.pipe(maven.deploy(config.snapshotConfig));
});
I've tried and the output doesn't show gulp finish message. Just deploy task started, deploying snapshot, the end. I've got your point but for some strange reasons it doesn't work like it should
Did you tried it on the latest version v0.2.0? I'd made some changes on the callback handling, maybe this affects this behavior. My output of the sample looks like this:
sample|develop⚡ ⇒ node ./node_modules/.bin/gulp
[09:09:13] Using gulpfile ~/Projects/gulp-maven-deploy/sample/gulpfile.js
[09:09:13] Starting 'deploy-local'...
archive path dist/sillysample.war
Executing command: mvn -B install:install-file -Dpackaging=war -Dfile=dist/sillysample.war -DgroupId=com.mygroup -DartifactId=sillysample -Dversion=0.0.2-SNAPSHOT
[09:09:17] Finished 'deploy-local' after 3.49 s
[09:09:17] Starting 'default'...
[09:09:17] Finished 'default' after 16 μs
Now it's totally async
[10:18:23] Starting 'deploy-snapshot'...
[10:18:23] Finished 'deploy-snapshot' after 2.22 ms
archive path dist\....war
Executing command: mvn -B deploy:deploy-file -Dpackaging=war -Dfile=dist\....war -DgroupId=no.storebrand.js -DartifactId=... -Dversion=0.1.5-SNAPSHOT -DrepositoryId=snapshots -Durl=...
Sorry, I forgot to add return statement. It seems to be ok! Nice! thanks
Uff, ok. Your last comment shocked me a little bit :laughing:
There is no example of callback usage in your documentation, but it could be really helpful. For example to make maven.deploy process end syncronosly, or post-deploy cleaning, etc.