Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] M2E WTP breaks my project structure

m2e-wtp reads the warSourceDirectory from the maven-war-plugin configuration. Since you haven't overridden, it uses the default value (src/main/webapp)

Thus you need to change your maven-war-plugin config to :

<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-war-plugin</artifactId>
   <version>2.2</version>
   <configuration>
     <warSourceDirectory>web-resources<warSourceDirectory>
     <webappDirectory>${basedir}/target/${project.build.finalName}</webappDirectory>
     <packagingExcludes>WEB-INF/lib/servlet-api*.jar</packagingExcludes>
   </configuration>
</plugin>

And dropping  
  <outputDirectory>${basedir}/target/${project.build.finalName}/WEB-INF/classes</outputDirectory>

   <directory>${basedir}/target/</directory>


should help you get your java sources back in eclipse, while keeping your project buildable in CLI. 

Update the project configuration after your pom modifications.

HIH

Fred Bricon

On Fri, Aug 31, 2012 at 1:15 PM, Emmanuel GUITON <Emmanuel.GUITON@xxxxxxxxxxxxx> wrote:

Hello all,

 

I have a Maven project for a webapp with a custom directory structure. For instance :

·         I have not test folder

·         sources are located in a ‘sources’ folder

·         web resources are located in a ‘web-resources’ folder.

When I update the project configuration, it results in a broken eclipse configuration :

·         a ‘src/main/webapp’ folder is automatically created, though it is not referenced in the POM, and is added to the web deployment assembly

·         my web resource folder (appropriately defined in the pom) is not added to the web deployment assembly (it is removed if it was added manually)

·         my sources folder is also ignored in the web deployment assembly, and also removed if it was added manually

·         a ‘src/test/java’ entry is added in the project java build path, and eclipse complains the folder is missing (indeed). The entry reappears if it was manually deleted.

 

It seems to me that the m2e-wtp plugins ignores the pom.xml content and just follows the default maven project structure.

Is there any way to make it respect the correct project structure ? And avoid to override the correct eclipse project settings ?

 

I use eclipse indigo and m2e-wtp 0.16.

Here are the relevant parts of my pom.xml :

 

                <build>

                               <defaultGoal>install</defaultGoal>

                               <finalName>libra-${project.artifactId}</finalName>

                               <sourceDirectory>${basedir}/sources/</sourceDirectory>

                               <outputDirectory>${basedir}/target/${project.build.finalName}/WEB-INF/classes</outputDirectory>

                               <directory>${basedir}/target/</directory>

                              

                                <resources>

                                               <resource>

                                                               <filtering>false</filtering>

                                                               <directory>sources</directory>

                                                               <excludes>

                                                                              <exclude>**/*.java</exclude>

                                                               </excludes>

                                               </resource>

                               </resources>

 

                               <plugins>

                                               <plugin>

                                                               <groupId>org.apache.maven.plugins</groupId>

                                                               <artifactId>maven-war-plugin</artifactId>

                                                               <version>2.2</version>

                                                               <configuration>

                                                                              <webResources>

                                                                                              <resource>

                                                                                                              <filtering>false</filtering>

                                                                                                              <directory>web-resources</directory>

                                                                                                              <includes>

                                                                                                                             <include>**.*</include>

                                                                                                              </includes>

                                                                                              </resource>

                                                                              </webResources>

                                                                              <webXml>${basedir}/web-resources/WEB-INF/web.xml</webXml>

                                                                               <webappDirectory>${basedir}/target/${project.build.finalName}</webappDirectory>

                                                                              <packagingExcludes>WEB-INF/lib/servlet-api*.jar</packagingExcludes>

                                                               </configuration>

                                               </plugin>

                               </plugins>

                </build>

 

Thanks,

-          emmanuel

 

Emmanuel GUITON

Ingénieur Développement
Fixe : +33 1  70 92 84 16 l Standard : +33 1 41 91 77 77

215, Avenue Georges Clemenceau l 92024 Nanterre


 Cliquez ici pour obtenir la dernière étude Markess sur le Cloud

_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users




--
"Have you tried turning it off and on again" - The IT Crowd

Back to the top