Control published files and folders in app classes folder in wtpwebapps [message #742539] |
Thu, 20 October 2011 11:32  |
Eclipse User |
|
|
|
hi, i am using eclipse helios 3.6.1 and WTP 3.2 with tomcat 7
and i am using maven 2 as build tool, m2eclipse plugin
when trying to run project on server, i get endless exceptions
this is opposite to running my project from maven tomcat plugin, everything works very fine
so i compared between the extracted war in target folder generated in my project (workspace/project/target/warFolder/classes)
and the extracted war in (wtpwebapps/myapp/WEB-INF/classes)
and here are the contents:
1- (workspace/project/target/warFolder/classes) contents:
com
messages
MET-INF
import.sql
log4j.properties
2- (wtpwebapps/myapp/WEB-INF/classes)
com
messages
MET-INF
import.sql
log4j.properties
.settings
src
target
.classpath
.project
file.txt
pom.xml
BTW, the published project folder contain only one folder which is WEB-INF and it doesn't contain resources folder (styles-images-scripts) and doesn't contain the META_INF too.
why it generates those additional unneeded folders?
when i remove those additional folders and try to run project on server from eclipse it runs fine
so question is how to control eclipse not to generate those folders, and why i get them in first place.
UPDATE: POM file plugins
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>install</id>
<phase>install</phase>
<goals>
<goal>sources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0-SNAPSHOT</version>
<configuration>
<path>/${project.build.finalName}</path>
</configuration>
</plugin>
</plugins>
|
|
|
Re: Control published files and folders in app classes folder in wtpwebapps [message #742610 is a reply to message #742539] |
Thu, 20 October 2011 12:49   |
Eclipse User |
|
|
|
It would appear that your project has a Java Source folder whose output
is mapped to the root of the project. This has the side effect of
making most everything in your project appear as build output to WTP,
causing to be included in the Web application. You should be able to
correct this on the Source tab of the Java Build Path page in the
project's Properties dialog.
I don't use maven or m2eclipse, so I can't say how well m2eclipse keeps
the Dynamic Web Project's configuration in sync with how it will build
the war. For this project, it appears some manual intervention is
required so that WTP will assemble the Web application with the same
resources that the maven build will.
Cheers,
Larry
On 10/20/2011 11:32 AM, Mahmoud Saleh wrote:
> hi, i am using eclipse helios 3.6.1 and WTP 3.2 with tomcat 7
> and i am using maven 2 as build tool, m2eclipse plugin
> when trying to run project on server, i get endless exceptions
> this is opposite to running my project from maven tomcat plugin,
> everything works very fine
>
> so i compared between the extracted war in target folder generated in my
> project (workspace/project/target/warFolder/classes)
>
> and the extracted war in (wtpwebapps/myapp/WEB-INF/classes)
>
> and here are the contents:
>
> 1- (workspace/project/target/warFolder/classes) contents:
>
> com
> messages
> MET-INF
> import.sql
> log4j.properties
>
> 2- (wtpwebapps/myapp/WEB-INF/classes)
>
> com
> messages
> MET-INF
> import.sql
> log4j.properties
>
> settings
> src
> target
> classpath
> project
> file.txt
> pom.xml
>
> BTW, the published project folder contain only one folder which is
> WEB-INF and it doesn't contain resources folder (styles-images-scripts)
> and doesn't contain the META_INF too.
> why it generates those additional unneeded folders?
> when i remove those additional folders and try to run project on server
> from eclipse it runs fine
>
> so question is how to control eclipse not to generate those folders, and
> why i get them in first place.
>
>
> UPDATE: POM file plugins
>
>
> <plugins>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-compiler-plugin</artifactId>
> <configuration>
> <source>1.6</source>
> <target>1.6</target>
> </configuration>
> </plugin>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-dependency-plugin</artifactId>
> <executions>
> <execution>
> <id>install</id>
> <phase>install</phase>
> <goals>
> <goal>sources</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-resources-plugin</artifactId>
> <version>2.5</version>
> <configuration>
> <encoding>UTF-8</encoding>
> </configuration>
> </plugin>
> <plugin>
> <groupId>org.apache.tomcat.maven</groupId>
> <artifactId>tomcat7-maven-plugin</artifactId>
> <version>2.0-SNAPSHOT</version>
> <configuration>
> <path>/${project.build.finalName}</path>
> </configuration>
> </plugin>
> </plugins>
|
|
|
|
|
|
|
Re: Control published files and folders in app classes folder in wtpwebapps [message #753115 is a reply to message #753050] |
Wed, 26 October 2011 12:35  |
Eclipse User |
|
|
|
On 10/26/2011 12:08 PM, Mahmoud Saleh wrote:
> one more question please:
> what's the default (Web Deployment Assembly) packaging structure for
> Java EE Web Application project
>
>
> Source: /src/main/java Deploy Path: WEB-INF/classes
> Source: /src/main/resources Deploy Path: WEB-INF/classes
> Source: /src/main/webapp Deploy Path: /
> Source: /src/test/java Deploy Path: WEB-INF/classes
> Source: Maven Dependencies Deploy Path: WEB-INF/lib
>
> above is what i have right now, and works fine with me, do you have any
> comments or feedback about this structure ?
What you have makes sense. A default Dynamic Web Project (feel free to
create one and see) would give you a "src" Java Source folder mapped to
"WEB-INF/classes" and a "WebContent" folder mapped to "/". There is
also a classpath container called "Web App Libraries" that is similar to
the "Maven Dependencies" that deals with jars destined for the project's
classpath and "WEB-INF/lib". WTP doesn't bother to list in the
Deployment Assembly page since it's not something you can alter.
Cheers,
Larry
|
|
|
Powered by
FUDForum. Page generated in 0.04772 seconds