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

Findbugs maven scan new code only
Jenkins job unable to access an environment variable
Can't sort a cyclic graph - Exception running Sonar with Eclipse RCP Application
Is SNAPSHOT or non-SNAPSHOT the convention for libraries and Maven when doing a release for others to use?
Extend maven cargo plugins jvmargs
bamboo plan generates rpm appended with snapshot and time stamp
Maven loads wrong version of dependency
No appenders could be found for logger (org.springframework.web.context.ContextLoader)
CircleCI circle.yml file - how to checkout differently with different branches
Maven: find usage of dependency by dependencies? [duplicate]
Maven structure with a single exposed artifact and internal dependencies
Automatically bumping up pom.xml with Maven release plugin
Use Maven to start programs
Sonatype Nexus endpoint for artifact's version number
Springboot with Maven running a react with webpack
Compile hadoop 2.7.2 have a error and I don't know why

Categories

HOME
ionic-framework
zeromq
appx
grep
bpmn
sqlite-net-extensions
electronics
disassembler
installshield
wamp
portia
amazon-cloudformation
primary-key
dacpac
facebook-php-sdk
etl
carthage
libtiff
finite-automata
oracle-coherence
openedx
alpine
emulator
autoconf
abi
excel-2007
android-widget
smb
sparse-matrix
brunch
maquette
replaceall
opentype
kendo-datasource
bcd
oracle-fusion-middleware
titanium-mobile
uiswipegesturerecognizer
amazon-kinesis-kpl
mapbox-gl
environment-modules
sequential
retina-display
hot-module-replacement
withings
objectlistview
unspecified
graphenedb
ibpy
fakeiteasy
keydown
businessworks
angular2-meteor
wso2carbon
azure-application-gateway
youcompleteme
zip4j
powercli
rdfs
togetherjs
gabor-filter
lowpass-filter
sqlclient
pg-dump
libusb-win32
imanage
titanium-android
webdriverjs
minimization
specrun
infix-notation
ctest
flash-cs5
ubuntu-10.04
qgraphicsview
python-stackless
bgp
apachebench
pervasive-sql
eclipse-clp
map-projections
ami
angular-local-storage
web-controls
unity5.2.3
directoryservices
ng-animate
xc16
tablelayout
client-side-templating
xcode-6.2
wp-query
system.net.webexception
file-locking
comaddin
eventlistener
html-editor
flashvars
drools-planner
anonymous-methods
funscript
pysimplesoap
windows-phone-7.1.1
code-cleanup
php-parser
gnu-prolog
window-management
hirefire
cinema-4d
android-sdk-2.1
google-friend-connect
xsdobjectgen
compiler-specific
noscript

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App