Update Project Configuration

Update Project Configuration

Hi folks! I'm trying to wrap my brain around m2eclipse and Maven in general. I'm quite new to it all.

I've been dutifully converting our pre-existing eclipse projects to use Maven to manage their dependencies. The projects which are libraries themselves, have the additional power to pop themselves into our Nexus repo when built with Maven.

Here's the snag... Eclipse does a fine job of running webapps and debugging, and exporting runnable jars and wars without any complicated configurations (and complicated is subjective). I was trying to have Maven manage the dependencies of the webapps and whatnot, continuing to use Eclipse's J2EE features, eliminating having to learn how to build webapps with Maven. I'm having a devil of a time though.

Here's one issue: When I get my build paths set back to where they need to be, if I select Maven -> Update Project Configuration, it wipes out all my customizations and puts them back to out-of-the-box configs. I would avoid using that but for two reasons. It seems like that option does more than just reset configurations to defaults, and sometimes you accidentally click on the wrong thing. Configuration zapped.

Re: Update Project Configuration

Version of Eclipse?

What specific features or settings are you specifying in Eclipse?

What Server are you using? Tomcat? JBoss?

On Feb 8, 2010, at 5:03 PM, Chris Gamache wrote:

> Hi folks! I'm trying to wrap my brain around m2eclipse and Maven in general. I'm quite new to it all.
>
> I've been dutifully converting our pre-existing eclipse projects to use Maven to manage their dependencies. The projects which are libraries themselves, have the additional power to pop themselves into our Nexus repo when built with Maven.
>
> Here's the snag... Eclipse does a fine job of running webapps and debugging, and exporting runnable jars and wars without any complicated configurations (and complicated is subjective). I was trying to have Maven manage the dependencies of the webapps and whatnot, continuing to use Eclipse's J2EE features, eliminating having to learn how to build webapps with Maven. I'm having a devil of a time though.
>
> Here's one issue: When I get my build paths set back to where they need to be, if I select Maven -> Update Project Configuration, it wipes out all my customizations and puts them back to out-of-the-box configs. I would avoid using that but for two reasons. It seems like that option does more than just reset configurations to defaults, and sometimes you accidentally click on the wrong thing. Configuration zapped.
>
> I could use some pointers for anyone who is doing the same thing.

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

Re: Update Project Configuration

Specifically, the default output folder, and in the Java EE Module Dependencies, trying to include Maven dependencies. They get reset when one selects Update Project Configurations.

What Server are you using? Tomcat? JBoss?

Tomcat.

On Feb 8, 2010, at 5:03 PM, Chris Gamache wrote:

> Hi folks! I'm trying to wrap my brain around m2eclipse and Maven in general. I'm quite new to it all.>> I've been dutifully converting our pre-existing eclipse projects to use Maven to manage their dependencies. The projects which are libraries themselves, have the additional power to pop themselves into our Nexus repo when built with Maven.
>> Here's the snag... Eclipse does a fine job of running webapps and debugging, and exporting runnable jars and wars without any complicated configurations (and complicated is subjective). I was trying to have Maven manage the dependencies of the webapps and whatnot, continuing to use Eclipse's J2EE features, eliminating having to learn how to build webapps with Maven. I'm having a devil of a time though.
>> Here's one issue: When I get my build paths set back to where they need to be, if I select Maven -> Update Project Configuration, it wipes out all my customizations and puts them back to out-of-the-box configs. I would avoid using that but for two reasons. It seems like that option does more than just reset configurations to defaults, and sometimes you accidentally click on the wrong thing. Configuration zapped.
>> I could use some pointers for anyone who is doing the same thing.

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail.

Re: Update Project Configuration

Hi everyone. I'm not trying to be a pest, but does anyone have any idea how I can keep "Update Project Configurations" from re-setting important settings which I have explicitly set in Eclipse configuration?

Specifically, the default output folder, and in the Java EE Module Dependencies, trying to include Maven dependencies. They get reset when one selects Update Project Configurations.

What Server are you using? Tomcat? JBoss?

Tomcat.

On Feb 8, 2010, at 5:03 PM, Chris Gamache wrote:

> Hi folks! I'm trying to wrap my brain around m2eclipse and Maven in general. I'm quite new to it all.>> I've been dutifully converting our pre-existing eclipse projects to use Maven to manage their dependencies. The projects which are libraries themselves, have the additional power to pop themselves into our Nexus repo when built with Maven.
>> Here's the snag... Eclipse does a fine job of running webapps and debugging, and exporting runnable jars and wars without any complicated configurations (and complicated is subjective). I was trying to have Maven manage the dependencies of the webapps and whatnot, continuing to use Eclipse's J2EE features, eliminating having to learn how to build webapps with Maven. I'm having a devil of a time though.
>> Here's one issue: When I get my build paths set back to where they need to be, if I select Maven -> Update Project Configuration, it wipes out all my customizations and puts them back to out-of-the-box configs. I would avoid using that but for two reasons. It seems like that option does more than just reset configurations to defaults, and sometimes you accidentally click on the wrong thing. Configuration zapped.
>> I could use some pointers for anyone who is doing the same thing.

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail.

Re: Update Project Configuration

I can't give you the official answer, but unofficially, what you're
trying to do isn't really possible with m2eclipse - it's actually
working as designed. If you want Maven to handle your dependencies,
but manage everything else with Eclipse, then I think you're probably
better off using the maven-eclipse-plugin - that is, the Eclipse
plugin for Maven rather than m2eclipse which is a Maven plugin for
Eclipse.

If you want to continue using m2eclipse (and I suggest that you do
because it's pretty awesome), then you're really going to need to
accept the Maven way and configure your POMs to produce your build
artifacts. If you're just building a WAR project, then it's really
very easy to do. If you're building an EAR, then it's not much
harder, but there is a little more configuration to do - especially if
you want to use 'skinny' WARs. Since I don't know anything about the
projects that you're building, I can't go into detail, but in general,
you need to configure the maven-war-plugin (and possibly the
maven-ear-plugin) in order to get the WTP integration of m2eclipse
working. Once you do that correctly, then you'll be able to do
Maven->Update Project Configuration and it will work correctly.

Basically, the idea is this: since you use Maven to build your
project, all configuration should be done in the POM. Configuring
stuff in Eclipse could get you into a situation where your project
runs fine in Eclipse, but when built by Maven doesn't work when
deployed to an app server.

> Hi everyone. I'm not trying to be a pest, but does anyone have any idea how
> I can keep "Update Project Configurations" from re-setting important
> settings which I have explicitly set in Eclipse configuration?
>
> On Mon, Feb 8, 2010 at 9:50 PM, Chris Gamache <[hidden email]> wrote:
>>
>>
>> On Mon, Feb 8, 2010 at 5:54 PM, Shick, Trever <[hidden email]>
>> wrote:
>>>
>>> Version of Eclipse?
>>>
>> Eclipse Galileo
>>
>>>
>>> What specific features or settings are you specifying in Eclipse?
>>>
>>> Specifically, the default output folder, and in the Java EE Module
>>> Dependencies, trying to include Maven dependencies. They get reset when one
>>> selects Update Project Configurations.
>>
>>
>>>
>>> What Server are you using? Tomcat? JBoss?
>>
>>
>> Tomcat.
>>
>>
>> On Feb 8, 2010, at 5:03 PM, Chris Gamache wrote:
>>
>> > Hi folks! I'm trying to wrap my brain around m2eclipse and Maven in
>> > general. I'm quite new to it all.
>> >
>> > I've been dutifully converting our pre-existing eclipse projects to use
>> > Maven to manage their dependencies. The projects which are libraries
>> > themselves, have the additional power to pop themselves into our Nexus repo
>> > when built with Maven.
>> >
>> > Here's the snag... Eclipse does a fine job of running webapps and
>> > debugging, and exporting runnable jars and wars without any complicated
>> > configurations (and complicated is subjective). I was trying to have Maven
>> > manage the dependencies of the webapps and whatnot, continuing to use
>> > Eclipse's J2EE features, eliminating having to learn how to build webapps
>> > with Maven. I'm having a devil of a time though.
>> >
>> > Here's one issue: When I get my build paths set back to where they need
>> > to be, if I select Maven -> Update Project Configuration, it wipes out all
>> > my customizations and puts them back to out-of-the-box configs. I would
>> > avoid using that but for two reasons. It seems like that option does more
>> > than just reset configurations to defaults, and sometimes you accidentally
>> > click on the wrong thing. Configuration zapped.
>> >
>> > I could use some pointers for anyone who is doing the same thing.
>>
>>
>>> This email and any files transmitted with it are confidential and
>>> intended solely for the use of the individual or entity to whom they are
>>> addressed. If you have received this email in error please notify the system
>>> manager. This message contains confidential information and is intended only
>>> for the individual named. If you are not the named addressee you should not
>>> disseminate, distribute or copy this e-mail.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>> http://xircles.codehaus.org/manage_email>>>
>>>
>>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

I can't give you the official answer, but unofficially, what you're
trying to do isn't really possible with m2eclipse - it's actually
working as designed. If you want Maven to handle your dependencies,
but manage everything else with Eclipse, then I think you're probably
better off using the maven-eclipse-plugin - that is, the Eclipse
plugin for Maven rather than m2eclipse which is a Maven plugin for
Eclipse.

If you want to continue using m2eclipse (and I suggest that you do
because it's pretty awesome), then you're really going to need to
accept the Maven way and configure your POMs to produce your build
artifacts. If you're just building a WAR project, then it's really
very easy to do. If you're building an EAR, then it's not much
harder, but there is a little more configuration to do - especially if
you want to use 'skinny' WARs. Since I don't know anything about the
projects that you're building, I can't go into detail, but in general,
you need to configure the maven-war-plugin (and possibly the
maven-ear-plugin) in order to get the WTP integration of m2eclipse
working. Once you do that correctly, then you'll be able to do
Maven->Update Project Configuration and it will work correctly.

Basically, the idea is this: since you use Maven to build your
project, all configuration should be done in the POM. Configuring
stuff in Eclipse could get you into a situation where your project
runs fine in Eclipse, but when built by Maven doesn't work when
deployed to an app server.

On Wed, Feb 10, 2010 at 11:42 AM, Chris Gamache <[hidden email]> wrote:
> Hi everyone. I'm not trying to be a pest, but does anyone have any idea how
> I can keep "Update Project Configurations" from re-setting important
> settings which I have explicitly set in Eclipse configuration?
>
> On Mon, Feb 8, 2010 at 9:50 PM, Chris Gamache <[hidden email]> wrote:
>>
>>
>> On Mon, Feb 8, 2010 at 5:54 PM, Shick, Trever <[hidden email]>
>> wrote:
>>>
>>> Version of Eclipse?
>>>
>> Eclipse Galileo
>>
>>>
>>> What specific features or settings are you specifying in Eclipse?
>>>
>>> Specifically, the default output folder, and in the Java EE Module
>>> Dependencies, trying to include Maven dependencies. They get reset when one
>>> selects Update Project Configurations.
>>
>>
>>>
>>> What Server are you using? Tomcat? JBoss?
>>
>>
>> Tomcat.
>>
>>
>> On Feb 8, 2010, at 5:03 PM, Chris Gamache wrote:
>>
>> > Hi folks! I'm trying to wrap my brain around m2eclipse and Maven in
>> > general. I'm quite new to it all.
>> >
>> > I've been dutifully converting our pre-existing eclipse projects to use
>> > Maven to manage their dependencies. The projects which are libraries
>> > themselves, have the additional power to pop themselves into our Nexus repo
>> > when built with Maven.
>> >
>> > Here's the snag... Eclipse does a fine job of running webapps and
>> > debugging, and exporting runnable jars and wars without any complicated
>> > configurations (and complicated is subjective). I was trying to have Maven
>> > manage the dependencies of the webapps and whatnot, continuing to use
>> > Eclipse's J2EE features, eliminating having to learn how to build webapps
>> > with Maven. I'm having a devil of a time though.
>> >
>> > Here's one issue: When I get my build paths set back to where they need
>> > to be, if I select Maven -> Update Project Configuration, it wipes out all
>> > my customizations and puts them back to out-of-the-box configs. I would
>> > avoid using that but for two reasons. It seems like that option does more
>> > than just reset configurations to defaults, and sometimes you accidentally
>> > click on the wrong thing. Configuration zapped.
>> >
>> > I could use some pointers for anyone who is doing the same thing.
>>
>>
>>> This email and any files transmitted with it are confidential and
>>> intended solely for the use of the individual or entity to whom they are
>>> addressed. If you have received this email in error please notify the system
>>> manager. This message contains confidential information and is intended only
>>> for the individual named. If you are not the named addressee you should not
>>> disseminate, distribute or copy this e-mail.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>> http://xircles.codehaus.org/manage_email
>>>
>>>
>>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

Re: Update Project Configuration

Well, I don't know if this is really documented anywhere - I couldn't
find it, so I had to look at the WTP integration code in m2eclipse to
figure out what exactly needs to be done. I've been working on a few
archetypes for my employer, but I don't think I'm allowed to share
them as is. Anyway, it's not exactly rocket science once you know
what m2eclipse is looking for to configure WTP, so I'll try to explain
what I did.

This example is for an EAR project with one EJB jar and one WAR, where
some of the WAR dependencies are supposed to end up in WEB-INF/lib,
and some of them are supposed to end up in the /lib folder of the EAR.
You could add more EJB or WAR projects, and utility jar projects
without too much trouble, but I'll keep this example simple because
there really isn't anything different to do for the more complicated
cases - just more of the same configuration.

In the EAR POM, you need to list any WAR dependencies that are
supposed to go in the EAR and not the WAR. This is unfortunate since
it means that there is some duplication. I use a top level parent POM
with a DependencyManagement section to define all of the dependencies
so that I at least don't need to duplicate the whole dependency
definition in both the EAR and the WAR - if you do it right, you'll
only need to list groupId and artifactId. So, the dependencies
section of the EAR might look like this:

The dependencies will end up in the /lib folder of the EAR since their
scope is 'compile' by default. The important part of this
configuration for m2eclipse is the definition of the ejbModule and the
webModule. This is part of what m2eclipse will use to generate the
WTP configuration files. By setting the bundleFileName, the files
that get placed in the EAR will not have the version appended to the
filenames. This is something that I always do, but I believe that
either RAD or WAS has problems when you let Maven do the default and
add the version - Eclipse and some other app server may not have the
same problem.

Now, for the WAR project, you need to list all of the dependencies
including those that are supposed to go into the EAR. It might look
like this:

The important part of this is the configuration is the
packagingExcludes section. This is what lets Maven know which
dependencies should be put in the Web App Libraries classpath
container, which should be put in the EAR Libraries container, and
which should be put in the Maven Dependencies container. I don't
remember offhand how that all plays out, but it works very nicely -
even if some dependencies are resolved in the workspace and some come
from the repository. Basically, anything that's excluded using the
packagingExcludes configuration ends up in the EAR Libraries classpath
container - which is the equivalent of using the
Project->Properties->Java EE Module Dependencies dialog to put EAR
dependencies on the classpath of the WAR using the MANIFEST.MF. I'm
not sure if that makes sense, but the best way to understand it is to
try it out, make configuration changes, and see what m2eclipse does
with your project configuration. It took me a while to understand
what was going on, but once I did, I've had very good success and
haven't needed to do any configuration with Eclipse.

I didn't mention anything about the EJB project configuration, but the
good news is that there isn't anything special that you need to do.
Since there really isn't any choice about where dependencies of the
EJB project end up (in the EAR), m2eclipse just gets it right without
any help.

I've actually gotten to the point where I can generate an EAR project
like this from an archetype, import it as an "existing Maven project"
into RAD 7.5, and immediately deploy it to a WAS test server with zero
configuration. The nice thing about this is that there is no need to
put the Eclipse/RAD metadata into version control, and developers
don't need to jump through any hoops to get started on a project -
just import and start writing code.

Now, as for GWT projects, I haven't a clue what you would need to do.
We don't use GWT at all, and I've only ever played with it a couple
times. I have a feeling that it might be tricky to get working, but
maybe someone else has some experience with it + m2eclipse?

>
> I'd like to continue to refine how our projects interact with Maven, so I
> really appreciate your ideas!
>
> The one flavor of WTP-esque project where maven just isn't up to snuff is
> for GWT projects. I think I've pretty well gotten the fragility out of our
> standard WAR-type projects.
>
> What I really need are some maven+m2eclipse recipes that match up with the
> goals you mentioned.... Any leads?
>
>
>
>
> On Thu, Feb 11, 2010 at 1:12 PM, Tim Schwenk <[hidden email]> wrote:
>>
>> I can't give you the official answer, but unofficially, what you're
>> trying to do isn't really possible with m2eclipse - it's actually
>> working as designed. If you want Maven to handle your dependencies,
>> but manage everything else with Eclipse, then I think you're probably
>> better off using the maven-eclipse-plugin - that is, the Eclipse
>> plugin for Maven rather than m2eclipse which is a Maven plugin for
>> Eclipse.
>>
>> If you want to continue using m2eclipse (and I suggest that you do
>> because it's pretty awesome), then you're really going to need to
>> accept the Maven way and configure your POMs to produce your build
>> artifacts. If you're just building a WAR project, then it's really
>> very easy to do. If you're building an EAR, then it's not much
>> harder, but there is a little more configuration to do - especially if
>> you want to use 'skinny' WARs. Since I don't know anything about the
>> projects that you're building, I can't go into detail, but in general,
>> you need to configure the maven-war-plugin (and possibly the
>> maven-ear-plugin) in order to get the WTP integration of m2eclipse
>> working. Once you do that correctly, then you'll be able to do
>> Maven->Update Project Configuration and it will work correctly.
>>
>> Basically, the idea is this: since you use Maven to build your
>> project, all configuration should be done in the POM. Configuring
>> stuff in Eclipse could get you into a situation where your project
>> runs fine in Eclipse, but when built by Maven doesn't work when
>> deployed to an app server.
>>
>>
>> On Wed, Feb 10, 2010 at 11:42 AM, Chris Gamache <[hidden email]>
>> wrote:
>> > Hi everyone. I'm not trying to be a pest, but does anyone have any idea
>> > how
>> > I can keep "Update Project Configurations" from re-setting important
>> > settings which I have explicitly set in Eclipse configuration?
>> >
>> > On Mon, Feb 8, 2010 at 9:50 PM, Chris Gamache <[hidden email]>
>> > wrote:
>> >>
>> >>
>> >> On Mon, Feb 8, 2010 at 5:54 PM, Shick, Trever
>> >> <[hidden email]>
>> >> wrote:
>> >>>
>> >>> Version of Eclipse?
>> >>>
>> >> Eclipse Galileo
>> >>
>> >>>
>> >>> What specific features or settings are you specifying in Eclipse?
>> >>>
>> >>> Specifically, the default output folder, and in the Java EE Module
>> >>> Dependencies, trying to include Maven dependencies. They get reset
>> >>> when one
>> >>> selects Update Project Configurations.
>> >>
>> >>
>> >>>
>> >>> What Server are you using? Tomcat? JBoss?
>> >>
>> >>
>> >> Tomcat.
>> >>
>> >>
>> >> On Feb 8, 2010, at 5:03 PM, Chris Gamache wrote:
>> >>
>> >> > Hi folks! I'm trying to wrap my brain around m2eclipse and Maven in
>> >> > general. I'm quite new to it all.
>> >> >
>> >> > I've been dutifully converting our pre-existing eclipse projects to
>> >> > use
>> >> > Maven to manage their dependencies. The projects which are libraries
>> >> > themselves, have the additional power to pop themselves into our
>> >> > Nexus repo
>> >> > when built with Maven.
>> >> >
>> >> > Here's the snag... Eclipse does a fine job of running webapps and
>> >> > debugging, and exporting runnable jars and wars without any
>> >> > complicated
>> >> > configurations (and complicated is subjective). I was trying to have
>> >> > Maven
>> >> > manage the dependencies of the webapps and whatnot, continuing to use
>> >> > Eclipse's J2EE features, eliminating having to learn how to build
>> >> > webapps
>> >> > with Maven. I'm having a devil of a time though.
>> >> >
>> >> > Here's one issue: When I get my build paths set back to where they
>> >> > need
>> >> > to be, if I select Maven -> Update Project Configuration, it wipes
>> >> > out all
>> >> > my customizations and puts them back to out-of-the-box configs. I
>> >> > would
>> >> > avoid using that but for two reasons. It seems like that option does
>> >> > more
>> >> > than just reset configurations to defaults, and sometimes you
>> >> > accidentally
>> >> > click on the wrong thing. Configuration zapped.
>> >> >
>> >> > I could use some pointers for anyone who is doing the same thing.
>> >>
>> >>
>> >>> This email and any files transmitted with it are confidential and
>> >>> intended solely for the use of the individual or entity to whom they
>> >>> are
>> >>> addressed. If you have received this email in error please notify the
>> >>> system
>> >>> manager. This message contains confidential information and is
>> >>> intended only
>> >>> for the individual named. If you are not the named addressee you
>> >>> should not
>> >>> disseminate, distribute or copy this e-mail.
>> >>>
>> >>> ---------------------------------------------------------------------
>> >>> To unsubscribe from this list, please visit:
>> >>>
>> >>> http://xircles.codehaus.org/manage_email>> >>>
>> >>>
>> >>
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>> http://xircles.codehaus.org/manage_email>>
>>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit: