maven-antrun-plugin

Run a Ant task in Maven only if a property is set

半腔热情 提交于 2019-12-03 14:10:43
My pom.xml is running an Ant task to deploy a file using FTP. However, this deployment must be only done if the -Dftp=true argument is given in the Maven command (i.e. mvn clean install -Dftp=true ). Thus, I wrote the following code: <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <version>1.2</version> <executions> <execution> <phase>package</phase> <goals> <goal>run</goal> </goals> <configuration> <tasks if="ftp"> <echo message="Deploying files through FTP..."/> ... </tasks> </configuration> </execution> </executions> Using

How to echo in Maven without Antrun plugin?

北战南征 提交于 2019-12-03 12:26:18
How can I print to the console while executing a mvn command (in a phase/goal), but not using Maven Antrun plugin? Why I reject Antrun solutions: The overhead in code to print a single message is massiv. The output is no formated like maven output I cannot attach a severity to the message (e.g. DEBUG, INFO, ERROR, etc) Currently an Ant-echo looks like this (see line with "hello world"): [INFO] --- maven-antrun-plugin:1.7:run (default) @ ejpd-alertmanager-ear --- [WARNING] Parameter tasks is deprecated, use target instead [INFO] Executing tasks main: [echo] hello world [INFO] Executed tasks

Maven: how to filter the same resource multiple times with different property values?

こ雲淡風輕ζ 提交于 2019-12-03 07:08:30
问题 Our project uses Log4J, configured via log4j.properties file. We have multiple production servers, which log to different log files, so that the logs can be differentiated. So log4j.properties for node 1 looks like this: ... log4j.appender.Application.File=D:/logs/application_1.log ... log4j.appender.tx_info.File=D:/logs/tx_info_1.log ... while the log4j.properties for node 2 looks like ... log4j.appender.Application.File=D:/logs/application_2.log ... log4j.appender.tx_info.File=D:/logs/tx

Maven Antrun Not Executing Tasks

筅森魡賤 提交于 2019-12-03 06:21:44
I'm using Maven AntRun plugin 1.6 and from their example I cannot code the following ant task to be executed. Example url: http://maven.apache.org/plugins/maven-antrun-plugin/examples/classpaths.html I just get the following message when I execute mvn antrun:run. No ant target defined - SKIPPED What am I doing wrong? Here's my POM: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <version>1.6</version> <executions> <execution> <id>compile</id> <phase>compile</phase> <configuration> <target> <property name="compile_classpath" refid="maven.compile

Maven: how to filter the same resource multiple times with different property values?

霸气de小男生 提交于 2019-12-02 20:40:57
Our project uses Log4J, configured via log4j.properties file. We have multiple production servers, which log to different log files, so that the logs can be differentiated. So log4j.properties for node 1 looks like this: ... log4j.appender.Application.File=D:/logs/application_1.log ... log4j.appender.tx_info.File=D:/logs/tx_info_1.log ... while the log4j.properties for node 2 looks like ... log4j.appender.Application.File=D:/logs/application_2.log ... log4j.appender.tx_info.File=D:/logs/tx_info_2.log ... We already use Maven profiles for generating our server configuration. Up to now it

Maven: Only execute plugin when a command line flag is present

瘦欲@ 提交于 2019-12-01 21:20:18
问题 I want Maven to only run a certain plugin when there is a flag on the command line when I call the mvn command. for example: Let's say I have a plugin called maven-foo-plugin . I only want maven to run this plugin when the flag --foo is present when I call the maven command. So, instead of saying... mvn install ...I would say... mvn install --foo The first one should NOT use/call the plugin maven-foo-plugin , but the second one should. By default, I don't want this plugin to run, but if and

Maven: execute antrun task during package

杀马特。学长 韩版系。学妹 提交于 2019-12-01 20:37:13
问题 I need to use the Maven antrun plugin to add Hibernate bytecode instrumentation to one of my Java classes, in order to enable lazy-loading of individual fields. However, I cannot get the plugin to execute during a build cycle. How can I instruct Maven to execute the antrun plugin after compilation but before packaging during a mvn package build? Current pom.xml (snippet): <pluginManagement> <plugins> ... <plugin> <artifactId>maven-antrun-plugin</artifactId> <version>1.7</version> <inherited

maven-antrun-plugin skip target if any of two possible conditions holds

匆匆过客 提交于 2019-12-01 09:22:32
I can pass two properties A and B to maven via mvn test -DA=true or mvn test -DB=true If either A or B is defined i want a target to be skipped. I found it was possible when only A was considered like this: <plugin> <artifactId>maven-antrun-plugin</artifactId> <version>1.7</version> <executions> <execution> <id>skiptThisConditionally</id> <phase>test</phase> <configuration> <target name="anytarget" unless="${A}"> <echo message="This should be skipped if A or B holds" /> </target> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin> Now B has to be considered

Gracefully stopping a java process started by maven-antrun-plugin

时光毁灭记忆、已成空白 提交于 2019-12-01 07:06:16
问题 This question is a result of an answer to this question from yesterday run a java application and a web application in a single maven build within a reactor project So as answered in the above question I now have a maven-antrun-plugin that forks a child process and runs my java appserver using a configuration like this - <plugin> <artifactId>maven-antrun-plugin</artifactId> <version>1.8</version> <executions> <execution> <phase> verify </phase> <configuration> <target> <property name="runtime

Maven antrun: pass maven properties to ant

泄露秘密 提交于 2019-12-01 02:32:15
I am trying to pass maven properties (defined through profiles) to a antrun execution: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <version>1.7</version> <dependencies> <!-- ... these are ok --> </dependencies> <executions> <execution> <configuration> <target> <property name="ant_destDir" value="${destDir}" /> <property name="ant_serverDeploy" value="${serverDeploy}" /> <property name="ant_deployDir" value="${deployDir}" /> <property name="ant_userDeploy" value="${userDeploy}" /> <property name="ant_passwordDeploy" value="${passwordDeploy}"