Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-dev] IClasspathDescriptor.removeEntry not deleting elements from Maven Classpath Container

IClasspathDescriptor passed to #configureClasspath descirbes Maven
dependencies classpath container entries, not the container itself.

Looks like you need something like

final List<String> compileDependencies = ...; classpath.removeEntry(new EntryFilter() {
    public boolean accept(IClasspathEntryDescriptor descriptor) {
return compileDependencies.contains(descriptor.getPath().toOSString());
    }
  });


IClasspathDescriptor describes classpath to be created or updated.
Actual JDT project model is not updated until after all involved project
configurators had the chance to make changes to the classpath descriptor
via their #configureClasspath or #configureRawClasspath.
JavaCore.getClasspathContainer, IJavaProject.getRawClasspath and other
JDT model getters will always return old/stale classpath during
#configureClasspath or #configureRawClasspath .

--
Regards,
Igor

On 11-10-30 11:23 AM, Ricardo Gladwell wrote:
Actually, I spoke too soon: the Maven classpath container does not
seem to exist yet when IJavaProjectConfigurator.configureClasspath is
called.

Do I need to build the container myself to over-ride its contents?

TIA...

--
Ricardo Gladwell<ricardo.gladwell@xxxxxxxxx>
http://www.google.com/profiles/ricardo.gladwell
Twitter: @rgladwell - MSN: axonrg@xxxxxxxxx



On 30 October 2011 14:25, Ricardo Gladwell<ricardo.gladwell@xxxxxxxxx>  wrote:
Hi Igor

Thanks, that seemed to work.

We are trying to remove non-runtime entries from the classpath for the
m2e-android project. The Eclipse Android plugin has changed the way it
builds and having the provided Android classes in the Maven Classpath
Container causes the build to fail.

Please see the code here:

https://github.com/rgladwell/m2e-android/blob/adt-14-support/me.gladwell.eclipse.m2e.android/src/main/java/me/gladwell/eclipse/m2e/android/configuration/RemoveNonCompileDependenciesConfigurer.java

Regards...

--
Ricardo Gladwell<ricardo.gladwell@xxxxxxxxx>
http://www.google.com/profiles/ricardo.gladwell
Twitter: @rgladwell - MSN: axonrg@xxxxxxxxx

On 30 October 2011 13:27, Igor Fedorenko<igor@xxxxxxxxxxxxxx>  wrote:
Yes, IClasspathDescriptor.removeEntry in the configureRawClasspath is
expected to work for *raw* classpath entries, i.e. source folders,
classpath containers, etc. To remove maven dependencies classpath
container entries, you need to call removeEntry from configureClasspath.

What entries are you trying to remove? Can I see code snippet that shows
how you do it? (complete standalone testcase would be even better).

For the reference, here is removeEntry implementation

http://git.eclipse.org/c/m2e/m2e-core.git/tree/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/ClasspathDescriptor.java#n86

--
Regards,
Igor

On 11-10-30 6:28 AM, Ricardo Gladwell wrote:

Hi Guys

We're trying to remove some of the classpath entries from the Maven
Classpath Container. However, a call to
IClasspathDescriptor.removeEntry in the configureRawClasspath method
doesn't seem to work.

Is this supported? Am I doing something wrong?

TIA...

--
Ricardo Gladwell<ricardo.gladwell@xxxxxxxxx>
http://www.google.com/profiles/ricardo.gladwell
Twitter: @rgladwell - MSN: axonrg@xxxxxxxxx

_______________________________________________
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