maven


Maven-antrun-plugin modify artifact before war is packaged


I have an application that is built via Maven, the end result being a .war file - which works all well and good.
It pulls a number of dependencies from a repository during the build and uses them within the application. One of these dependencies is a jar file, within the jar file is a zip file and within that zip is one file that I want to remove.
Using maven-antrun-plugin i have managed to move that jar to a tmp location from TARGET and explode the jar file. I then explode the zip file, remove the offending file, package everything back together and put it in TARGET once more.
The problem is that this happens after the WAR file is built so the new jar that i put back into TARGET is not used. I know this is because it has already been packaged so I tried to alter the JAR before this stage using similar to below (Found via: Run an ant task in maven build phase before war is packaged?)
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>deploy-ui</id>
<phase>package</phase>
<inherited>false</inherited>
<configuration>
<target>
<-- JAR was modified in here -->
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<!-- First step is to disable the default-war build step. -->
<id>default-war</id>
<phase>none</phase>
</execution>
<execution>
<!-- Second step is to create an exploded war. Done in prepare-package -->
<id>war-exploded</id>
<phase>prepare-package</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
<execution>
<!-- Last step is to make sure that the war is built in the package phase -->
<id>custom-war</id>
<phase>package</phase>
<goals>
<goal>war</goal>
</goals>
</execution>
</executions>
</plugin>
It successfully runs the ant plugin after the war is exploded but before it has been packaged and therefore it cannot find any file that I reference in the TARGET directory?
Is there anyway to get it so that I can reference files in TARGET before the war is completed? If not can some suggest an alternative.
Note: I cannot upload a new dependency to the repo and/or use a local copy.

Related Links

passing version of a dependency during a release build in maven
Get maven properties from external configuration file
How does Maven handle transitive dependencies inherited from parent?
maven build error : No plugin found for prefix 'system' in the current project [duplicate]
cucumber.runtime.CucumberException: Failed to instantiate class
Jenkins fails to parse POM with variables
How can I stop generating md5, sha1 jars being created in maven
Issue with Jenkins pipeline script and docker maven image
How to override maven project version in teamcity
SnappyData version 0.6 not found in Maven
Best way to get licenses for mvn jars
How NOT to skip tests in my maven test project?
How to use <mirrors> and <servers> in settings.xml only for some projects
Unknown lifecycle phase “–P”
Jenkins SCM poll with release build
how to build river package?

Categories

HOME
google-play
lodash
fme
q
windows-server
mvvmcross
azure-media-services
directx
append
facebook-messenger-bot
session-variables
gnupg
vifm
tomcat6
handsontable
correlation
collectd
apache-cayenne
iolanguage
footer
database-replication
interop
code-review
alpine
errorlevel
ehcache
captiveportal
restful-authentication
url-scheme
intel-pin
wtx
vision
bpel
instant-messaging
.net-4.0
semantic-versioning
data-manipulation
stacked
event-driven
dynamics-crm-2013
hue
angularjs-factory
greenrobot-eventbus
cookiecutter-django
sas-visual-analytics
android-tabhost
nomethoderror
acoustics
qcombobox
strptime
ionicons
domain-model
idisposable
setter
worker-thread
capacity
instant
slicknav
ado.net-entity-data-model
measures
google-web-starter-kit
impresspages
packagist
apachebench
two-factor-authentication
wso2cloud
marching-cubes
jqgrid-formatter
deis
angular-local-storage
proj4js
notify
geonetwork
qpainter
zend-route
dml
expected-exception
doskey
mysql-error-1062
pyhdf
sitemesh
ruby-datamapper
batterylevel
comaddin
lcs
referrer
getmessage
appconkit
qtkit
boost-filesystem
external-accessory
mod-auth
celltable
floating
sudzc
compiler-specific
data-driven
yagni
sector
putchar

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App