You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by RobJac <ro...@caritor.com> on 2006/04/21 12:46:59 UTC

Avoid Build folder when creating EAR/WAR

I am trying to create an EAR for my project using Maven2. Its creating EAR
properly but i guess it initialy creates an EAR folder in my ${basedir} and
then EARs it from there. How can i get this folder deleted after the EAR is
created? I am facing the same issue while creating a WAR project as well,
but creating my JAR projects does not have this issue. My EAR pom xml looks
like this. Hope I am clear here.

<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"> 
        <modelVersion>4.0.0</modelVersion> 
        <groupId>DB_EA</groupId> 
        <artifactId>DB_EA</artifactId> 
        <packaging>ear</packaging> 
        <version>1.0</version> 
        <dependencies> 
            <dependency> 
              <groupId>A</groupId> 
              <artifactId>A</artifactId> 
              <version>1.0</version> 
              <type>jar</type> 
            </dependency> 
        </dependencies> 
        <build> 
            <directory>${basedir}</directory> 
            <finalName>${project.artifactId}</finalName> 
            <plugins> 
              <plugin> 
                <groupId>org.apache.maven.plugins</groupId> 
                <artifactId>maven-ear-plugin</artifactId> 
                <configuration> 
                <earSourceDirectory>${basedir}/src</earSourceDirectory> 
                  <archive> 
                    <manifest> 
                      <addClasspath>true</addClasspath> 
                    </manifest> 
                  </archive> 
                  <generateApplicationXml>false</generateApplicationXml> 
                </configuration> 
              </plugin> 
            </plugins> 
        </build> 
</project> 

--
View this message in context: http://www.nabble.com/Avoid-Build-folder-when-creating-EAR-WAR-t1485825.html#a4024144
Sent from the Maven - Users forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Avoid Build folder when creating EAR/WAR

Posted by RobJac <ro...@caritor.com>.
Thanks Wayne. I undertand its trivial but was just trying to avoid
redundancy. I downloaded the ant-run-plugin. Could you please let me know
how can i get this folder removed immediately after executing mvn package. I
tried providing the following under my pom xml

        <artifactId>maven-antrun-plugin</artifactId>
	        <executions>
	          <execution>
	            <phase>generate-sources</phase>
	            <configuration>
	              <tasks>
	              <delete dir="${project.build.directory}"/>
	              </tasks>
	            </configuration>
	            <goals>
	              <goal>run</goal>
	            </goals>
	          </execution>
	        </executions>
      </plugin>
but here it was trying to delete even before the packaging had started. I
see a <phase> , should i specify something here so that it will delete the
folder only after packaging?
--
View this message in context: http://www.nabble.com/Avoid-Build-folder-when-creating-EAR-WAR-t1485825.html#a4028236
Sent from the Maven - Users forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Avoid Build folder when creating EAR/WAR

Posted by Wayne Fay <wa...@gmail.com>.
You can use the antrun plugin to perform random tasks at specific
times of the build process.

http://maven.apache.org/plugins/maven-antrun-plugin/usage.html

I'd create a task to delete that folder using ant immediately after
packaging things up, I suppose. However, this is such a trivial issue
(at least to me), that I would probably just ignore it.

Wayne

On 4/21/06, RobJac <ro...@caritor.com> wrote:
>
> I am trying to create an EAR for my project using Maven2. Its creating EAR
> properly but i guess it initialy creates an EAR folder in my ${basedir} and
> then EARs it from there. How can i get this folder deleted after the EAR is
> created? I am facing the same issue while creating a WAR project as well,
> but creating my JAR projects does not have this issue. My EAR pom xml looks
> like this. Hope I am clear here.
>
> <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">
>        <modelVersion>4.0.0</modelVersion>
>        <groupId>DB_EA</groupId>
>        <artifactId>DB_EA</artifactId>
>        <packaging>ear</packaging>
>        <version>1.0</version>
>        <dependencies>
>            <dependency>
>              <groupId>A</groupId>
>              <artifactId>A</artifactId>
>              <version>1.0</version>
>              <type>jar</type>
>            </dependency>
>        </dependencies>
>        <build>
>            <directory>${basedir}</directory>
>            <finalName>${project.artifactId}</finalName>
>            <plugins>
>              <plugin>
>                <groupId>org.apache.maven.plugins</groupId>
>                <artifactId>maven-ear-plugin</artifactId>
>                <configuration>
>                <earSourceDirectory>${basedir}/src</earSourceDirectory>
>                  <archive>
>                    <manifest>
>                      <addClasspath>true</addClasspath>
>                    </manifest>
>                  </archive>
>                  <generateApplicationXml>false</generateApplicationXml>
>                </configuration>
>              </plugin>
>            </plugins>
>        </build>
> </project>
>
> --
> View this message in context: http://www.nabble.com/Avoid-Build-folder-when-creating-EAR-WAR-t1485825.html#a4024144
> Sent from the Maven - Users forum at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>