Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-dev] Getting "missing required source folder: 'src/test/java'" for m2e 1.1

Hi Igor

Sorry, to clarify, an instance of the JavaProjectConfigurator I create
using the default constructor is injected into
AndroidMavenProjectConfigurator. The rough order of the code is that:

1. The ADT configures the project.
2. I then call the JavaProjectConfigurator.configure() method.
3. Then I modify the project configuration to integrate with the ADT.

I try to modify the project via the IClasspathDesriptor mutator, but not
all the code configuration I need can be changed that way. For example,
I need to modify the Android project configuration which might, in turn,
modify the classpath.

I imagine I'm probably going about this the wrong way and I should be
able to simply run the JavaProjectConfigurator using plugin.xml
configuration but I have no idea how to go about this. I've reviewed the
code and I can clearly see the addSourceDirs() method is creating source
entries with the "optional" attribute.

However, running in debug mode and stepping through the
AbstractJavaProjectConfigurator.configure() method I can clearly see it
removing the optional attribute at line 141:

javaProject.setRawClasspath(classpath.getEntries(), classesFolder.getFullPath(), monitor);

I can keep poking the API until I get the right order of calls but
I'd really appreciate some help from the people who wrote m2e to point
me in the right direction.

Regards...

-- 
Ricardo
Twitter: @rgladwell


On Sun, 2012-09-02 at 10:14 -0400, Igor Fedorenko wrote:
> I don't know much about m2e/adt integration, so can't tell if the code
> does anything wrong (can't really tell what it does without knowing what
> instances get injected and how).
> 
> Not sure if this will help, but you can see overall m2e/jdt project
> configuration logic in [1]. The code that creates source folders is [2].
> 
> One thing to note is that java project configurators are not supposed to
> manipulated jdt project configuration directly. They are supposed to
> mutate provided IClasspathDescriptor instance.
> 
> [1] 
> https://git.eclipse.org/c/m2e/m2e-core.git/tree/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java?id=releases/1.1/1.1.0.20120530-0009#n103
> [2] 
> https://git.eclipse.org/c/m2e/m2e-core.git/tree/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java?id=releases/1.1/1.1.0.20120530-0009#n357
> 
> 
> --
> Regards,
> Igor
> 
> On 12-09-02 7:34 AM, Ricardo Gladwell wrote:
> > Hi Igor
> >
> > I think I've narrowed it down as to why my plugin is stripping out the
> > optional attributes for source folder classpath entries. I inject an
> > instance of the JavaProjectConfigurator into my project, which I call
> > before I start to re-configure my project:
> >
> > javaProjectConfigurator.configure(request, monitor);
> >
> > Please see here:
> >
> > https://github.com/rgladwell/m2e-android/blob/master/me.gladwell.eclipse.m2e.android/src/main/java/me/gladwell/eclipse/m2e/android/AndroidMavenProjectConfigurator.java#L68
> >
> > For some reason the JavaProjectConfigurator is stripping out these
> > attributes, am I doing something wrong?
> >
> > TIA...
> >
> > --
> > Ricardo Gladwell <ricardo.gladwell@xxxxxxxxx>
> > Web: http://gladwell.me/ - Twitter: @rgladwell
> > GTalk: ricardo.gladwell@xxxxxxxxx
> >
> >
> > On 28 August 2012 12:52, Igor Fedorenko <igor@xxxxxxxxxxxxxx> wrote:
> >> All source folders created by m2e 1.1+ should be marked as optional.
> >> Looks like android tooling does not respect that classpath entry attribute.
> >>
> >> See [1] for some background info and discussion
> >>
> >> [1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=361549
> >>
> >>
> >> --
> >> Regards,
> >> Igor
> >>
> >>
> >> On 12-08-28 5:47 AM, Ricardo Gladwell wrote:
> >>>
> >>> Hi Guys
> >>>
> >>> Since I upgraded to m2e 1.1 I've been getting an error message "missing
> >>> required source folder: 'src/test/java'" for android-maven-plugin
> >>> projects in Eclipse despite the fact I don't have a "src/test/java"
> >>> folder in my Android project source tree.
> >>>
> >>> How is m2e 1.1 getting this additional source folder? Am I doing
> >>> something wrong with my m2e extension? Or is the android-maven-plugin
> >>> adding test source folders to the MavenProject model even when they
> >>> don't exist?
> >>>
> >>> TIA...
> >>>
> >> _______________________________________________
> >> m2e-dev mailing list
> >> m2e-dev@xxxxxxxxxxx
> >> https://dev.eclipse.org/mailman/listinfo/m2e-dev
> > _______________________________________________
> > m2e-dev mailing list
> > m2e-dev@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/m2e-dev
> >
> _______________________________________________
> m2e-dev mailing list
> m2e-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/m2e-dev




Back to the top