javamaventomcatresin

Redirecting the output directory of 'mvn package' or 'mvn compile' command


I am working on a Java project (where maven is the build tool) with resin server. I found some nice plugins for Tomcat by which if I issue a 'mvn compile' then the compiled file goes to the <tomcat>/webapps directory. But I have not found any plugin for resin to do the same task. So now I am trying to change the output directory for 'mvn compile' or 'mvn package' command. Can anyone suggest me how can I do this?

By default the output of mvn compile or mvn package goes to the <project_dir>/target. But I want to place the output to '~/resin_hosts' directory.

Thanks in advance


Solution

  • Try setting the following property in the POM:

    <build>
        <outputDirectory>${user.home}/resin_hosts</outputDirectory>
    </build>
    

    The maven-jar-plugin also allows changing the directory of the jar:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.5</version>
        <configuration>
           ...
           <outputDirectory>output_dir</outputDirectory>
        </configuration>
    </plugin>