maven


Augment maven compilation task


In Maven, using the compiler plugin, we can do
mvn compile
and compile the project. What I need is to compile the project AND do some other stuff.
For instance, in ANT I can do this:
public class Main extends Javac13 {
#Override
public boolean execute() throws BuildException {
System.out.println("Main::execute");
attributes.log("Using modern compiler", Project.MSG_VERBOSE);
Commandline cmd = setupModernJavacCommand();
try {
int result = com.sun.tools.javac.Main.compile(cmd.getArguments());
return result == 0;
} catch (Exception ex) {
if (ex instanceof BuildException) {
throw (BuildException) ex;
} else {
throw new BuildException("Error starting modern compiler", ex, location);
}
}
}
#Override
public void setJavac(Javac javac) {
System.out.println("Main::setJavac " + javac);
super.setJavac(javac);
}
}
launching it in this way:
ant -Dbuild.compiler=com.moc.Main ...
the class above became the compiler and I can do whatever I want with the command line that ANT give to me.
Also, the great thing is that I don't need to touch the build.xml file. I just need to set a system property.
Is there something like this in Maven?
You can have a look system-properties-maven-plugin I knocked-up a while ago. It allows you to define the system properties in your pom.xml. Have a look at the USAGE file.
The plugin has two goals -- one for setting the properties (set) and one for restoring them back to the original way they were (reset).

Related Links

How to ignore MARKUPs from ruta output or from JCas?
Why are my resources not getting copied in the “validate” phase?
Different classpath between IntelliJ and mvn
Apache Archiva: how do I edit Artifact information?
Running docker-maven-plugin on the very end of parent pom building
Intellij: How to create context-sensitive Maven shortcuts
How to use property values in postinstall scripts during Maven build
Maven: No source to compile
jgitflow start-release fails for https url with OAuth token
is there any alternative for maven reactor plugin?
Cannot capture network packets in storm spout using jNetpcap
How to create 'resources' folder in Intellij?
Gradle tells me ' Must specify a repository for deployment'
Grails Unit Testing occurring on Wrong Phase of Maven Life Cycle
Maven variables set after running goals cannot be resolved in IDEA [duplicate]
Release project with SNAPSHOT test dependency

Categories

HOME
java
compiler-construction
coq
webpack
zeromq
push-notification
raspberry-pi
react-router
xmpp
framework7
electronics
ebean
azure-storage-tables
multiple-records
handsontable
jplayer
gz
systemc
visual-composer
predix
object-detection
opencover
errorlevel
orleans
google-search-api
pass-by-reference
claims-based-identity
trading
crystal-reports-2010
angular2-aot
su
phpfox
saas
msys2
windowbuilder
directx-10
bosh
google-cloud-endpoints-v2
column-family
perlin-noise
html5-fullscreen
devextreme
main
abstract-class
opshub
ws-security
hp-ux
ibpy
btrace
flickr-api
react-scripts
multipeer-connectivity
paxos
python-webbrowser
domain-model
veracode
elgg
quartz-composer
phishing
thrust
ready-api
whois
pickadate
xpath-1.0
energy
historian
ford-fulkerson
vhd
intel-fortran
ora-00900
computer-algebra-systems
emailrelay
android-listview
fluid-dynamics
mmc
tablelayout
rdtsc
html-helper
android-radiobutton
elliptic-curve
fluentautomation
xceed-datagrid
quantlib-swig
coverflow
jplaton
shellexecute
back-stack
html4
ember-app-kit
android-hardware
robotics-studio
wsdl-2.0
factory-method
angularjs-controller
browser-detection
javaspaces
osql
amazon-appstore
code-cleanup
coredump
xmemcached
disclosure
asp.net-mvc-areas
icanhaz.js
mirah
web-architecture
scripting-languages

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