Maven exec plugin for clean phase -


i'm using exec-maven-plugin execute custom clean script during pre-clean phase of pom life cycle. purpose of script clean bunch of log files , test artifacts created during compile , test phases. script needs know paths these files, being filtered maven-resources-plugin during initialize phase.

i've found bad design choice: can mvn clean after i've done mvn initialize. not issue, since need clean after having done something... however, i've started use maven-release-plugin, tries mvn clean deploy, fails due clean script not being available.

i've thought of following possible solutions:

  1. use maven-clean-plugin

  2. attach script different phase

  3. modify script doesn't need filtering

i don't either of those, because:

  1. i want use script cleaning up, since allows me keep pom file clean (there lot of files need remove, , don't want have specify of them manually maven-clean-plugin).

  2. not possible: test results need picked jenkins after testing, cannot clean them during build , test cycle. there no other phases in clean cycle can bind to.

  3. sort of possible, in near future (might) want release directly jenkins, has access sh (not bash), can't use relative paths unless ugly export path=.:$path.

how can resolve problem, considering restrictions have on jenkins server (not under control)?

not results end in target folder.

there's problem :-) cleanest solution fix that, , use 1). alternatively, consider conditional script. commit src/main/bin:

#!/bin/sh  if [ -f target/generated-clean-script ];     sh target/generated-clean-script fi 

and run unconditionally in clean. it'll nothing on first run, clean on build after initialize has generated script.

as variant of 2), consider not binding phase. run script directly when need to, not through maven.


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -