You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jörg Hohwiller <jo...@j-hohwiller.de> on 2012/05/09 22:05:52 UTC

Re: help needed: problems with eclipse, m2e and wst (FIXED)

Hi everybody,

I found a solution to my problem.

Everybody hates digging through threads where people are having the same problem
but then no answer or something like "I found the problem,
was a stupid mistake". Therefore here it is:

1. Upgrade to m2e 1.1.0
Now the projects in deployment assembly were present except for a single one
that was always missing.

2. The <packagingExcludes> contain a pattern matching the JAR of the missing
project.
This is by intention as this project contains the configuration for the
development environment and is provided on other environments. It should
therefore not be bundled with the released WAR so it remains portable.

I never expected m2e to treat such special things of maven war plugin and IMHO
this is more a bug than a feature.

However, my solution is to add a profile triggered by the property
"eclipse.application" that "undefines" the <packagingExcludes>.

Now everything rocks again with m2e :)

Unfortunately I was not forced to check out Webby yet ;)

Regards
  Jörg


> Hi Ron,
> 
> thanks for your response.
> However, it seems I was NOT preceise and have been misunderstood.
> I try to make it very clear now...
> 
> What I have is this project structure:
> 
> + mypoject (packaging: pom)
> |
> +-+ subsystem1 (packaging: pom)
> | |
> | +-+ subsystem1-shared (packaging: jar)
> | |
> | +-+ subsystem1-client (packaging: jar)
> | |
> | +-+ subsystem1-server (packaging: jar)
> +-+ subsystem2 (packaging: pom)
> | |
> | +-+ subsystem2-shared (packaging: jar)
> | |
> | +-+ subsystem2-client (packaging: jar)
> | |
> | +-+ subsystem2-server (packaging: jar)
> ...
> +-+ subsystemN (packaging: pom)
> | |
> | +-+ subsystemN-shared (packaging: jar)
> | |
> | +-+ subsystemN-client (packaging: jar)
> | |
> | +-+ subsystemN-server (packaging: jar)
> +-+ application (packaging: pom)
> | |
> | +-+ application-client (packaging: jar, dependencies on all *-client modules)
> | |
> | +-+ application-server (packaging: jar, dependencies on all *-server modules)
> | |
> | +-+ application-webapp (packaging: war)
> 
> I am using eclipse and m2e and for all JAR/WAR modules, I do have an according
> eclipse project. I think this is natural and did not think that someone would
> not have this.
> 
>>> No. I mean internal dependencies to my own artefacts not external libraries.
>>> Or in other words dependencies on eclipse projects.
> 
> What I meant with this, is that I have things like
> 
> <dependency>
>   <groupId>${project.groupId}</groupId>
>   <artifactId>subsystem1-shared</artifactId>
>   <version>${project.version}</version>
> </dependency>
> 
> These get transitive dependencies of application-webapp.
> No application-webapp has all these dependencies in the maven-dependencies.
> However, in deployment assembly some of these internal dependencies are missing
> (exactly 2 of them, seems to be reproducible, but I cannot find the reason).
> Classes and resources out of these modules/projects are therefore not found
> if I launch tomcat from eclipse. If I manually add the missing projects in
> deployment assembly, everything is fine. However m2e frequently overrides my
> changes and that is the bad thing about m2e.
> With mvn eclipse:eclipse, I do have the control over settings important to me
> and I can control the point in time when to update. This makes it robust in case
> of problems. However it is very cool to have m2e and get dependencies updated,
> if I update SVN and a POM has changed. However, in case the automagic algorithm
> is wrong, the entire team is quickly in big trouble.
> 
>> Having dependencies on Eclipse projects can be problematic.
>>
>> 1) If you think that the problems is Eclipse related, you might want to try
>> Springframework's Eclipse STS. It comes with everything that you need to use maven
>> to build Java projects.
> 
> Nope. The problem is originated in m2e-wtp. That is for sure.
> 
>>
>> 2) What Repo server are you using? It is highly recommended to use a repo with
>> maven and deploy your snapshots when they are ready to be used in other projects.
> 
> I am using artifactory. However, I do not see any relation to my problem.
> 
>>
>> 3) Turning off Eclipse's use of other projects to resolve dependencies means
>> that you are sure that your dependencies are being resolved from your local
>> Maven folder on your workstation which you have been put there by  a maven build
>> and install.
> 
> I do not get this one. Seems to be related to the misunderstanding...
> So far as I can tell:
> I do not want to have this in any way. However, wtp seems to work only in this
> way. In the end the resources and classes are NOT really read from the JARs in
> maven target folders as I can see that code hot deployment is working during
> debugging. However it appears to me that classes/resources have to be initially
> present in the JARs. Might be related to tomcats context class loader hell...
> 
> If someone could shed a light into this or point me to a link I would be very
> pleased, as I do not entirely understand this magic.
> 
>>
>> Ron
> 
> Thanks
>   Jörg
> 
>>
>>
>> On 04/05/2012 3:25 AM, Jörg Hohwiller wrote:
>>> Hi Daniel,
>>>
>>> thank you for your help and response...
>>>
>>>> You're talking about missing dependencies to libraries, not Maven modules, it
>>>> that correct?
>>> No. I mean internal dependencies to my own artefacts not external libraries.
>>> Or in other words dependencies on eclipse projects.
>>>
>>>> Did you try going to Project Properties>  Deployment Assembly ?
>>> Yes. This is where the "org.eclipse.wst.common.component" file is
>>> configured. I can also fix my problem here by clicking "add" and then
>>> "projects" and then selecting the missing projects.
>>>
>>> I am absolutely and 100% sure that the missing projects are dependencies
>>> of that WAR-packaging module/project. I also checked by "dependency hierarchy"
>>> tab of the m2e POM view as well as with mvn dependency:tree.
>>>
>>>> Is "Maven Dependencies" shown?
>>> Yes, it is. However only if the project dependencies are also present,
>>> it works.
>>>
>>> Then IMHO this is a bug of m2e such that these maven dependencies are calculated
>>> wrong or exclude the eclipse internal project dependencies
>>> and those are calculated wrong by m2e-wtp.
>>>
>>>> If not, click on Add>  Java Build Path Entries>  Maven
>>>> Dependencies>  Finish
>>>>
>>>> Then, to be safe, remove the project from Tomcat in the Servers view, click
>>>> Publish, and add the project to the Tomcat instance in the Servers view.
>>> Unfortunately that's not the case.
>>>
>>>> HTH,
>>>> Daniel Serodio
>>> Best Regards
>>>    Jörg
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>
>>
> 
> 


-- 
If know-how becomes know-where, then knowledge gets nowhere.
  [Jörg Hohwiller]

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