tags:

views:

31

answers:

2

Hello I'm wondering if there is a way to print what is the actual environment variables that maven is using... something like mvn --verbose --debug ? I don't find anything with google.

A: 

It'll require some changes to the pom.

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-antrun-plugin</artifactId>
  <version>1.1</version>
  <executions>
    <execution>
      <phase>validate</phase>
      <goals>
        <goal>run</goal>
      </goals>
      <configuration>
        <tasks>
          <echo>[MAVEN_OPTIONS]${env.MAVEN_OPTIONS}</echo>
        </tasks>
      </configuration>
    </execution>
  </executions>
</plugin>

Of course, it might be simplest to run

echo $MAVEN_OPT
sblundy
hi sblundy,I tried the way you suggested but I don't get anything printed (not even "[MAVEN_OPTIONS]". [Here](http://gist.github.com/461791) I pasted the entire output and the pom.xml ...I think the 'echo $MAVEN_OPT' might not tell what maven really sees, because often more then one place can be used to define those settings (i.e. .mavenrc) . I found handy to ask maven "what options do you actually see?"thnx
Xan
A: 

You can use Maven Help Plugin and help:system goal, so your pom will be:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
    <modelVersion>4.0.0</modelVersion>
    <groupId>testMavenOpt</groupId>
    <artifactId>testMavenOpt</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>testMavenOpt</name>
    <url>http://maven.apache.org&lt;/url&gt;
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-help-plugin</artifactId>
                <version>2.1</version>
            </plugin>
        </plugins>
    </build>
</project>

and you should execute mvn help:system

ZloiAdun
that shows me all kinds of stuff, but no MAVEN_OPTIONS
seanizer
It lists all environment variables, so if you do not see the MAVEN_OPTIONS then they are not set in your environment. Or do you mean something else?
ZloiAdun