You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Vincent F <vi...@sgcib.com> on 2009/10/21 19:21:38 UTC

maven-eclipse-plugin and src/main/webapp with Eclipse

Hi,

I'm trying to move my current project structure to Maven Standard Directory
Layout, so that everything I had in /WebContent is now in src/main/webapp .
It works fine for the packaging.

However, when using maven-eclipse-plugin 2.7 to update my Eclipse project
and configuration files, I was expecting that src/main/webapp would be seen
by Eclipse like a source folder, just like src/main/java and
src/main/resources. Instead, it is seens as a regular folder, so I have to
drill down from src to main to webapp to access my files. 

I've tried several things in maven-eclipse-plugin configuration, like

<sourceIncludes>
    <sourceInclude>src/main/webapp/**/*.*</sourceInclude>
</sourceIncludes>

for example, but it doesn't work.

Is there a way to fix this ? Or maybe it is not meant to be fixed because I
shouldn't have src/main/webapp as a source folder ?
Any piece of advice would be appreciated

Thanks

-- 
Vincent




 
-- 
View this message in context: http://www.nabble.com/maven-eclipse-plugin-and-src-main-webapp-with-Eclipse-tp25996692p25996692.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


RE: maven-eclipse-plugin and src/main/webapp with Eclipse

Posted by Roland Asmann <Ro...@cfc.at>.
Also, if you use WTP in Eclipse, it will work this way. I'd guess that if
you would get it to work, Eclipse would probably build incorrect WAR-files
because it would include the contents of that folder as both resources and
as real web-application.

So, just get used to it, it isn't broken and therefor doesn't need fixing!

Roland


> It doesn't really make sense for src/main/webapp to be a source folder -
> it doesn't contain compilable source files.
>
> Justin
>
> -----Original Message-----
> From: Vincent F [mailto:vincent.fuchs@sgcib.com]
> Sent: Wednesday, October 21, 2009 1:22 PM
> To: users@maven.apache.org
> Subject: maven-eclipse-plugin and src/main/webapp with Eclipse
>
>
> Hi,
>
> I'm trying to move my current project structure to Maven Standard
> Directory Layout, so that everything I had in /WebContent is now in
> src/main/webapp .
> It works fine for the packaging.
>
> However, when using maven-eclipse-plugin 2.7 to update my Eclipse
> project and configuration files, I was expecting that src/main/webapp
> would be seen by Eclipse like a source folder, just like src/main/java
> and src/main/resources. Instead, it is seens as a regular folder, so I
> have to drill down from src to main to webapp to access my files.
>
> I've tried several things in maven-eclipse-plugin configuration, like
>
> <sourceIncludes>
>     <sourceInclude>src/main/webapp/**/*.*</sourceInclude>
> </sourceIncludes>
>
> for example, but it doesn't work.
>
> Is there a way to fix this ? Or maybe it is not meant to be fixed
> because I shouldn't have src/main/webapp as a source folder ?
> Any piece of advice would be appreciated
>
> Thanks
>
> --
> Vincent
>
>
>
>
>
> --
> View this message in context:
> http://www.nabble.com/maven-eclipse-plugin-and-src-main-webapp-with-Ecli
> pse-tp25996692p25996692.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>



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


Re: maven-eclipse-plugin and src/main/webapp with Eclipse

Posted by Barrie Treloar <ba...@gmail.com>.
On Sat, Oct 24, 2009 at 1:58 AM, Vincent F <vi...@sgcib.com> wrote:
>
> OK, thanks everyone for these additional infos. I may stick with WTP
> organisation then (using /WebContent/ instead of /src/main/webapp/) just for
> convenience in Eclipse.

You should be able to use /src/main/webapp thats what the file
.settings/org.eclipse.wst.common.component is for.

Why not have a look at what is in this file for a standard WTP project
and then see if you can set the values to point to /src/main/webapp.
eclipse:eclipse is meant to support it from my understanding.
Maybe it is out of sync with your version of WTP.

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


Re: maven-eclipse-plugin and src/main/webapp with Eclipse

Posted by Vincent F <vi...@sgcib.com>.
OK, thanks everyone for these additional infos. I may stick with WTP
organisation then (using /WebContent/ instead of /src/main/webapp/) just for
convenience in Eclipse.

-- 
Vincent



baerrach wrote:
> 
> On Fri, Oct 23, 2009 at 10:50 AM, Benson Margulies
> <bi...@gmail.com> wrote:
>> An Eclipse project type, or perspective, can decide to show the tree any
>> way
>> it likes. The default Java perspective shows all folders as ordinary
>> folders
>> except source folders. It hauls source folders to the top of the project,
>> gives them a special icon, and labels them with the full pathname (e.g.
>> "src/main/java"). In a WTP project, the web content root is also hauled
>> to
>> the top and specially labelled.  There is no general scheme for marking
>> some
>> arbitrary folder for this treatment. So, unless you are using WTP, and
>> telling eclipse:eclipse to write configuration for WTP, you are stuck
>> with
>> the irritating folder location. Unless you want to write your own Eclipse
>> plugin that rearranged the display in this case.
> 
> Thanks Benson, not working with WTP myself, this was exactly what I
> wanted to explain to Vincent.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/maven-eclipse-plugin-and-src-main-webapp-with-Eclipse-tp25996692p26028471.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: maven-eclipse-plugin and src/main/webapp with Eclipse

Posted by Barrie Treloar <ba...@gmail.com>.
On Fri, Oct 23, 2009 at 10:50 AM, Benson Margulies
<bi...@gmail.com> wrote:
> An Eclipse project type, or perspective, can decide to show the tree any way
> it likes. The default Java perspective shows all folders as ordinary folders
> except source folders. It hauls source folders to the top of the project,
> gives them a special icon, and labels them with the full pathname (e.g.
> "src/main/java"). In a WTP project, the web content root is also hauled to
> the top and specially labelled.  There is no general scheme for marking some
> arbitrary folder for this treatment. So, unless you are using WTP, and
> telling eclipse:eclipse to write configuration for WTP, you are stuck with
> the irritating folder location. Unless you want to write your own Eclipse
> plugin that rearranged the display in this case.

Thanks Benson, not working with WTP myself, this was exactly what I
wanted to explain to Vincent.

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


Re: maven-eclipse-plugin and src/main/webapp with Eclipse

Posted by Benson Margulies <bi...@gmail.com>.
An Eclipse project type, or perspective, can decide to show the tree any way
it likes. The default Java perspective shows all folders as ordinary folders
except source folders. It hauls source folders to the top of the project,
gives them a special icon, and labels them with the full pathname (e.g.
"src/main/java"). In a WTP project, the web content root is also hauled to
the top and specially labelled.  There is no general scheme for marking some
arbitrary folder for this treatment. So, unless you are using WTP, and
telling eclipse:eclipse to write configuration for WTP, you are stuck with
the irritating folder location. Unless you want to write your own Eclipse
plugin that rearranged the display in this case.

On Thu, Oct 22, 2009 at 6:21 PM, Barrie Treloar <ba...@gmail.com> wrote:

> On Fri, Oct 23, 2009 at 6:31 AM, Vincent F <vi...@sgcib.com>
> wrote:
> >
> > My plugin configuration is the following
> >
> > <plugin>
> >      <groupId>org.apache.maven.plugins</groupId>
> >      <artifactId>maven-eclipse-plugin</artifactId>
> >      <version>2.7</version>
> >         <configuration>
> >             <packaging>war</packaging>
> >             <useProjectReferences>false</useProjectReferences>
> >             <wtpversion>2.0</wtpversion>
> >             <downloadSources>true</downloadSources>
> >         </configuration>
> > </plugin>
> >
> > So as you can see, packaging is "war" but /src/main/webapp is not added
> as a
>
> You dont need to specify packaging, its default value is
> ${project.packaging} so it should already be set to war.
>
> > I don't see warSourceDirectory as a maven-eclipse-plugin's property, but
> > rather maven-war-plugin. How would that have an impact on
> > maven-eclipse-plugin ?
>
> The code pulls the value out from the maven war plugin configuration,
> and defaults to /src/main/webapp as below:
>
>    File warSourceDirectory =
>                new File( IdeUtils.getPluginSetting(
> config.getProject(), JeeUtils.ARTIFACT_MAVEN_WAR_PLUGIN,
>
> "warSourceDirectory", //$NON-NLS-1$
>
> config.getProject().getBasedir() + "/src/main/webapp" ) );
> //$NON-NLS-1$
>
> > source. In the .classpath file, the 2 only relevant lines are
> >  <classpathentry kind="src" path="src/main/java" including="**/*.java"/>
> >  <classpathentry kind="src" path="src/main/resources"
> > excluding="**/*.java"/>
> >
> > but nothing about src/main/webapp
> >
>
> I dont use WTP so I am only going by the docs and the code.
>
> From the looks of the code /src/main/webapp doesn't get added to the
> .classpath file, it gets added to
>  .settings/org.eclipse.wst.common.component
> file as
>  <wb-resource deploy-path="/" source-path="src/main/webapp"/>
>
> And looking at the integration tests, I dont think what you are asking
> for is how eclipse:eclipse works.
>
> From the little reading I have done on the documentation
> src/main/webapp refers to your web sources and thus they shouldn't be
> on the classpath.
> I think you are stuck drilling down those directories manually.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: maven-eclipse-plugin and src/main/webapp with Eclipse

Posted by Barrie Treloar <ba...@gmail.com>.
On Fri, Oct 23, 2009 at 6:31 AM, Vincent F <vi...@sgcib.com> wrote:
>
> My plugin configuration is the following
>
> <plugin>
>      <groupId>org.apache.maven.plugins</groupId>
>      <artifactId>maven-eclipse-plugin</artifactId>
>      <version>2.7</version>
>         <configuration>
>             <packaging>war</packaging>
>             <useProjectReferences>false</useProjectReferences>
>             <wtpversion>2.0</wtpversion>
>             <downloadSources>true</downloadSources>
>         </configuration>
> </plugin>
>
> So as you can see, packaging is "war" but /src/main/webapp is not added as a

You dont need to specify packaging, its default value is
${project.packaging} so it should already be set to war.

> I don't see warSourceDirectory as a maven-eclipse-plugin's property, but
> rather maven-war-plugin. How would that have an impact on
> maven-eclipse-plugin ?

The code pulls the value out from the maven war plugin configuration,
and defaults to /src/main/webapp as below:

    File warSourceDirectory =
                new File( IdeUtils.getPluginSetting(
config.getProject(), JeeUtils.ARTIFACT_MAVEN_WAR_PLUGIN,

"warSourceDirectory", //$NON-NLS-1$

config.getProject().getBasedir() + "/src/main/webapp" ) );
//$NON-NLS-1$

> source. In the .classpath file, the 2 only relevant lines are
>  <classpathentry kind="src" path="src/main/java" including="**/*.java"/>
>  <classpathentry kind="src" path="src/main/resources"
> excluding="**/*.java"/>
>
> but nothing about src/main/webapp
>

I dont use WTP so I am only going by the docs and the code.

>From the looks of the code /src/main/webapp doesn't get added to the
.classpath file, it gets added to
  .settings/org.eclipse.wst.common.component
file as
  <wb-resource deploy-path="/" source-path="src/main/webapp"/>

And looking at the integration tests, I dont think what you are asking
for is how eclipse:eclipse works.

>From the little reading I have done on the documentation
src/main/webapp refers to your web sources and thus they shouldn't be
on the classpath.
I think you are stuck drilling down those directories manually.

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


Re: maven-eclipse-plugin and src/main/webapp with Eclipse

Posted by Vincent F <vi...@sgcib.com>.
My plugin configuration is the following

<plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-eclipse-plugin</artifactId>
      <version>2.7</version>
         <configuration>
             <packaging>war</packaging>
             <useProjectReferences>false</useProjectReferences>
             <wtpversion>2.0</wtpversion>
             <downloadSources>true</downloadSources>
         </configuration>
</plugin>

So as you can see, packaging is "war" but /src/main/webapp is not added as a
source. In the .classpath file, the 2 only relevant lines are
  <classpathentry kind="src" path="src/main/java" including="**/*.java"/>
  <classpathentry kind="src" path="src/main/resources"
excluding="**/*.java"/>

but nothing about src/main/webapp

I don't see warSourceDirectory as a maven-eclipse-plugin's property, but
rather maven-war-plugin. How would that have an impact on
maven-eclipse-plugin ?


Thanks

-- 
Vincent 





baerrach wrote:
> 
> On Thu, Oct 22, 2009 at 9:37 AM, Vincent F <vi...@sgcib.com>
> wrote:
>>
>> Thanks for your answer. I'm going to be very picky here, but is there a
>> way
>> to have the src/main/webapp folder " folded as one in Eclipse, just like
>> the
>> src/main/java and src/main/resources are ?
> 
> Can you please post how you are running eclipse:eclipse?
> I suspect that you are not enabling wtp support.
> 
> Have you read
> http://maven.apache.org/plugins/maven-eclipse-plugin/examples/multi-module-projects.html
> 
> I can see from the eclipse plugins code that if packaging = "war" then
> a source directory is added.
> The default is /src/main/webapp
> You can configure this via the warSourceDirectory property.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/maven-eclipse-plugin-and-src-main-webapp-with-Eclipse-tp25996692p26016271.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: maven-eclipse-plugin and src/main/webapp with Eclipse

Posted by Barrie Treloar <ba...@gmail.com>.
On Thu, Oct 22, 2009 at 9:37 AM, Vincent F <vi...@sgcib.com> wrote:
>
> Thanks for your answer. I'm going to be very picky here, but is there a way
> to have the src/main/webapp folder " folded as one in Eclipse, just like the
> src/main/java and src/main/resources are ?

Can you please post how you are running eclipse:eclipse?
I suspect that you are not enabling wtp support.

Have you read http://maven.apache.org/plugins/maven-eclipse-plugin/examples/multi-module-projects.html

I can see from the eclipse plugins code that if packaging = "war" then
a source directory is added.
The default is /src/main/webapp
You can configure this via the warSourceDirectory property.

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


RE: maven-eclipse-plugin and src/main/webapp with Eclipse

Posted by Vincent F <vi...@sgcib.com>.
Thanks for your answer. I'm going to be very picky here, but is there a way
to have the src/main/webapp folder " folded as one in Eclipse, just like the
src/main/java and src/main/resources are ?

Vincent



justinedelson wrote:
> 
> It doesn't really make sense for src/main/webapp to be a source folder -
> it doesn't contain compilable source files.
> 
> Justin 
> 
> -----Original Message-----
> From: Vincent F [mailto:vincent.fuchs@sgcib.com] 
> Sent: Wednesday, October 21, 2009 1:22 PM
> To: users@maven.apache.org
> Subject: maven-eclipse-plugin and src/main/webapp with Eclipse
> 
> 
> Hi,
> 
> I'm trying to move my current project structure to Maven Standard
> Directory Layout, so that everything I had in /WebContent is now in
> src/main/webapp .
> It works fine for the packaging.
> 
> However, when using maven-eclipse-plugin 2.7 to update my Eclipse
> project and configuration files, I was expecting that src/main/webapp
> would be seen by Eclipse like a source folder, just like src/main/java
> and src/main/resources. Instead, it is seens as a regular folder, so I
> have to drill down from src to main to webapp to access my files. 
> 
> I've tried several things in maven-eclipse-plugin configuration, like
> 
> <sourceIncludes>
>     <sourceInclude>src/main/webapp/**/*.*</sourceInclude>
> </sourceIncludes>
> 
> for example, but it doesn't work.
> 
> Is there a way to fix this ? Or maybe it is not meant to be fixed
> because I shouldn't have src/main/webapp as a source folder ?
> Any piece of advice would be appreciated
> 
> Thanks
> 
> --
> Vincent
> 
> 
> 
> 
>  
> -- 
> View this message in context:
> http://www.nabble.com/maven-eclipse-plugin-and-src-main-webapp-with-Ecli
> pse-tp25996692p25996692.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/maven-eclipse-plugin-and-src-main-webapp-with-Eclipse-tp25996692p26001637.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


RE: maven-eclipse-plugin and src/main/webapp with Eclipse

Posted by "Edelson, Justin" <Ju...@mtvstaff.com>.
It doesn't really make sense for src/main/webapp to be a source folder -
it doesn't contain compilable source files.

Justin 

-----Original Message-----
From: Vincent F [mailto:vincent.fuchs@sgcib.com] 
Sent: Wednesday, October 21, 2009 1:22 PM
To: users@maven.apache.org
Subject: maven-eclipse-plugin and src/main/webapp with Eclipse


Hi,

I'm trying to move my current project structure to Maven Standard
Directory Layout, so that everything I had in /WebContent is now in
src/main/webapp .
It works fine for the packaging.

However, when using maven-eclipse-plugin 2.7 to update my Eclipse
project and configuration files, I was expecting that src/main/webapp
would be seen by Eclipse like a source folder, just like src/main/java
and src/main/resources. Instead, it is seens as a regular folder, so I
have to drill down from src to main to webapp to access my files. 

I've tried several things in maven-eclipse-plugin configuration, like

<sourceIncludes>
    <sourceInclude>src/main/webapp/**/*.*</sourceInclude>
</sourceIncludes>

for example, but it doesn't work.

Is there a way to fix this ? Or maybe it is not meant to be fixed
because I shouldn't have src/main/webapp as a source folder ?
Any piece of advice would be appreciated

Thanks

--
Vincent




 
-- 
View this message in context:
http://www.nabble.com/maven-eclipse-plugin-and-src-main-webapp-with-Ecli
pse-tp25996692p25996692.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


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