The easiest way (that I can think of) to set up an Eclipse Java project as a
dynamic web project is to run the maven eclipse plugin. I suggest that you
do this from the command line and not from the M2eclipse plugin:
1. >mvn eclipse:clean   (clean out the existing Eclipse configuration)
2. >mvn eclipse:eclipse -Dwtpversion=1.5 (this will create the .project,
.classpath, and .settings dir files that you will need)

If you want to have the maven project nature included in the .project file,
check the maven eclipse plugin configuration and add the properties to the
build section of your pom. The resulting pom should look something like the
following:

  <plugins>
  <plugin>
    <artifactId>maven-eclipse-plugin</artifactId>
    <configuration>
     <additionalProjectnatures>
      <projectnature>
       org.springframework.ide.eclipse.core.springnature
      </projectnature>
      <projectnature>org.maven.ide.eclipse.maven2Nature</projectnature>
      <projectnature>
       org.eclipse.wst.common.project.facet.core.nature
      </projectnature>
      <projectnature>
       org.eclipse.wst.common.modulecore.ModuleCoreNature
      </projectnature>
      <projectnature>org.eclipse.jem.workbench.JavaEMFNature</projectnature>
      <projectnature>org.maven.ide.eclipse.maven2projectnature
</projectnature>
      <projectnature>
       org.springframework.ide.eclipse.core.springprojectnature
      </projectnature>
      <projectnature>
       edu.umd.cs.findbugs.plugin.eclipse.findbugsprojectnature
      </projectnature>
      <projectnature>org.eclipse.ajdt.ui.ajnature</projectnature>
      <projectnature>org.eclipse.ajdt.ui.ajprojectnature</projectnature>
     </additionalProjectnatures>
     <additionalBuildcommands>
      <buildCommand>
       <name>org.eclipse.ajdt.core.ajbuilder</name>
       <arguments></arguments>
      </buildCommand>
      <buildCommand>
       <name>org.eclipse.wst.common.project.facet.core.builder</name>
       <arguments></arguments>
      </buildCommand>
      <buildCommand>
       <name>org.eclipse.wst.validation.validationbuilder</name>
       <arguments></arguments>
      </buildCommand>
      <buildCommand>
       <name>edu.umd.cs.findbugs.plugin.eclipse.findbugsBuilder</name>
       <arguments></arguments>
      </buildCommand>
      <buildCommand>
       <name>org.eclipse.ajdt.core.ajbuilder</name>
       <arguments></arguments>
      </buildCommand>
      <buildCommand>
       <name>org.maven.ide.eclipse.maven2Builder</name>
       <arguments></arguments>
      </buildCommand>
      <buildCommand>
       <name>org.springframework.ide.eclipse.core.springbuilder</name>
       <arguments></arguments>
      </buildCommand>
     </additionalBuildcommands>
    </configuration>
   </plugin>
</plugins>


Currently, executing a maven build before deploying from Eclipse (using the
server deploy tool) is not supported (by anyone that I know). However, this
should give you a good start.

Good luck,
Richard
On Jan 24, 2008 6:04 AM, Adam Hardy <[EMAIL PROTECTED]> wrote:

>
> Eclipse is doing something bad here.
>
> I set up my project (call it A) as the only project in the workspace. The
> project has a dependency, call it B, and the jar for B is installed in my
> local
> repository.
>
> Like this everything works fine. The dynamic web project, the tomcat
> deploy, the
> maven dependency management.
>
> Now the bad stuff: I then imported project B into the workspace. Project A
> saw
> that it had a dependency on this and automatically rebuilt itself, and
> unfortunately broke. It couldn't see the classes in B anymore, and it
> wouldn't
> show the J2EE Module Dependencies anymore, because:
>
> "The currently displayed page contains invalid values."
>
> Where do I go from here, guys?
>
> Thanks
> Adam
>
>
>
>
>
>
> Adam Hardy on 23/01/08 15:08, wrote:
> > I'm using eclipse 3.3.1.1 and m2-eclipse 0.0.12
> >
> > What's the best way to set up a dynamic web project in eclipse (with
> > existing code)? I've tried it several times today and I have problems
> > with the project dependencies.
> >
> > Firstly the Project Preferences / J2EE Module Dependencies dialog
> > breaks, with the error pop-up: "The currently displayed page contains
> > invalid values".
> >
> > Secondly when deployed onto the embedded tomcat6 server, tomcat can't
> > find the classes I am using from a dependency which is also a project in
> > Eclipse.
> >
> > The steps which seemed most logical to set up my project are:
> >
> > * create a new dynamic web project from the Eclipse File menu
> > * copy the source code 'src/main' and src/test' directories into new
> folder
> > * refresh the project
> > * configure the build path to include src/main/java, src/main/resources
> etc
> > * turn on maven dependency management
> > * copy the old pom into the new project folder
> > * refresh the project and let it finish building
> > * go to Project Preferences / Java Build Path / Projects dialog and set
> > the project dependencies
> > * go to Project Preferences / J2EE Module Dependencies and set the
> > projects there too
> > * rebuild
> > * add to tomcat
> >
> > For some reason, it gets messed up.
> >
> > Do I actually need the Project Dependencies in the Java Build Path /
> > Projects dialog?
> >
> > Is there any particular setting I should use in the tomcat config?
> >
> > Is there any way to repair the Eclipse config that stops the J2EE Module
> > Dependencies dialog showing?
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

Reply via email to