Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration with m2eclipse #78

Closed
foal opened this issue Jul 5, 2015 · 9 comments
Closed

Integration with m2eclipse #78

foal opened this issue Jul 5, 2015 · 9 comments

Comments

@foal
Copy link
Contributor

foal commented Jul 5, 2015

m2eclipse plugin generate classpathentry for src/test/java event if the project miss it (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=424200).

The gwt-eclipse-plugin shows the "The archive: /com.jresearchsoft.booking.ft.common.domain/src/test/java which is referenced by the classpath, does not exist." and brake the run until I manually remove "wrong" classpathentry.

The classpathentry has optional attribute so the gwt-eclipse-plugin MAY ignore it and continue to run.

@branflake2267
Copy link
Contributor

Gotcha, I've had this issue. Thanks for reporting. When the physical source path doesn't exist for test it causes an issue because m2e sets it up anyway. This feels like a m2e issue, although I'll have to investigate further.

@foal
Copy link
Contributor Author

foal commented Oct 8, 2015

Ok, inasmuch as it is so annoying to cleanup ~30 projects from generated staff after each project update I spent few hours and find the the reason (workaround).

The problem is in the launch generator. The default launch configuration SHOULD NOT include the test sources. It does not resolve the "optional" issue, but it resolve MY issue (all my wrong classpath entries are from tests).

Nonetheless the launch configuration INCLUDE all the sources from the projects. The reason is in wrong test Source Folder detection.

gwt-eclipse-plugin\plugins\com.google.gwt.eclipse.core\src\com\google\gwt\eclipse\core\GWTProjectUtilities.java

  public static boolean isTestPath(IPath path) {
    return "test".equals(path.lastSegment())
        || "javatests".equals(path.lastSegment());
  }

It tests the last segment, but the standard maven project has "src/test/java".

So if you will fix the test Source Folder detection it will eliminate the issue with m2e which generate non existing classpath entries.

@foal
Copy link
Contributor Author

foal commented Oct 8, 2015

Ok. It is not a real solution, because it fix include/exclude tests from launch configuration. To fix he original issue you should change fillGWTSourceFolderPathsFromProject from the same class (GWTProjectUtilities) to check IClasspathEntry is optional (like bellow)

public boolean isOptional() {
        for (int i = 0, length = this.extraAttributes.length; i < length; i++) {
            IClasspathAttribute attribute = this.extraAttributes[i];
            if (IClasspathAttribute.OPTIONAL.equals(attribute.getName()) && "true".equals(attribute.getValue())) //$NON-NLS-1$
                return true;
        }
        return false;
    }

and check if curClasspathEntry.getPath() exists on the file system.

@foal
Copy link
Contributor Author

foal commented Oct 8, 2015

Do I have to create a separate issue for incorrect including test sources to run-time classpath?

@branflake2267
Copy link
Contributor

Looks fine. I guess you don't have to create an issue for that.

@branflake2267
Copy link
Contributor

I'm out of country at the moment and tired, so I'll wait till I get back to merge it. Thats the 15th and a couple days to recover. Then I can merge and build the snapshot.

@foal
Copy link
Contributor Author

foal commented Oct 9, 2015

Greate 👍

branflake2267 added a commit that referenced this issue Oct 31, 2015
@branflake2267
Copy link
Contributor

Merged and updated repo. I've marked this fixed and if you can verify that would be great.

@foal
Copy link
Contributor Author

foal commented Nov 5, 2015

I update the workspace with new version, it continue works. I am going to create new workspace from scratch in few days. will let you know if it will works correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants