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

Project import gets org.eclipse.jdt.core.JavaModelException #2866

Closed
KakashiMamun opened this issue Oct 24, 2016 · 10 comments
Closed

Project import gets org.eclipse.jdt.core.JavaModelException #2866

KakashiMamun opened this issue Oct 24, 2016 · 10 comments
Assignees
Labels
kind/bug Outline of a bug - must adhere to the bug report template. sprint/current

Comments

@KakashiMamun
Copy link

KakashiMamun commented Oct 24, 2016

[Project import gets org.eclipse.jdt.core.JavaModelException]

Reproduction Steps:

I have a project with these modles

  • <module>scheduler-build</module>
    
  • <module>scheduler-typelayout</module>
    
  • <module>scheduler-dto</module>
    
  • <module>scheduler-biz</module>
    
  • <module>scheduler-bizcore</module>
    
  • <module>scheduler-front/aggregator-pom.xml</module>
    
  • <module>scheduler-batch</module>
    
  • <module>scheduler-webapi</module>
    
  • <module>scheduler-webapi-spec</module>
    
  • <module>scheduler-webapi-client</module>
    

As you can see the 'front' project have an aggregator pom rather than a pom xml. the aggregator pom
has these modules

  • <module>./client-side-pom.xml</module>
    
  • <module>./pom.xml</module>
    

when i import my project to che it gives me the following error

org.eclipse.jdt.core.JavaModelException: Can't find parent folder: /hue-scheduler/hue-scheduler-front/aggregator-pom.xml/.codenvy
at org.eclipse.jdt.internal.core.JavaProject.writeFileEntries(JavaProject.java:2023) ~[org.eclipse.jdt.ui-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at org.eclipse.jdt.internal.core.JavaModelManager$PerProjectInfo.writeAndCacheClasspath(JavaModelManager.java:2789) ~[org.eclipse.jdt.ui-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at org.eclipse.jdt.internal.core.JavaModelManager$PerProjectInfo.writeAndCacheClasspath(JavaModelManager.java:2802) ~[org.eclipse.jdt.ui-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at org.eclipse.jdt.internal.core.SetClasspathOperation.executeOperation(SetClasspathOperation.java:77) ~[org-eclipse-jdt-core-repack-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:808) ~[org.eclipse.jdt.ui-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:877) ~[org.eclipse.jdt.ui-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at org.eclipse.jdt.internal.core.JavaProject.setRawClasspath(JavaProject.java:422) ~[org.eclipse.jdt.ui-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at org.eclipse.jdt.internal.core.JavaProject.setRawClasspath(JavaProject.java:370) ~[org.eclipse.jdt.ui-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at org.eclipse.jdt.internal.core.JavaProject.setRawClasspath(JavaProject.java:391) ~[org.eclipse.jdt.ui-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at org.eclipse.che.plugin.maven.server.core.MavenWorkspace.updateJavaProject(MavenWorkspace.java:179) [che-plugin-maven-server-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at org.eclipse.che.plugin.maven.server.core.MavenWorkspace$$Lambda$114/1441100330.accept(Unknown Source) [che-plugin-maven-server-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at java.util.HashMap$KeySet.forEach(HashMap.java:928) [na:1.8.0_45]
at org.eclipse.che.plugin.maven.server.core.MavenWorkspace.createNewProjects(MavenWorkspace.java:134) [che-plugin-maven-server-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at org.eclipse.che.plugin.maven.server.core.MavenWorkspace.access$100(MavenWorkspace.java:59) [che-plugin-maven-server-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at org.eclipse.che.plugin.maven.server.core.MavenWorkspace$2.projectUpdated(MavenWorkspace.java:105) [che-plugin-maven-server-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_45]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_45]
at org.eclipse.che.plugin.maven.server.core.MavenProjectManager.lambda$createListenersDispatcher$0(MavenProjectManager.java:101) [che-plugin-maven-server-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at org.eclipse.che.plugin.maven.server.core.MavenProjectManager$$Lambda$12/1461180347.invoke(Unknown Source) [che-plugin-maven-server-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at com.sun.proxy.$Proxy57.projectUpdated(Unknown Source) [na:na]
at org.eclipse.che.plugin.maven.server.core.MavenProjectManager$UpdateState.fireUpdate(MavenProjectManager.java:519) [che-plugin-maven-server-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at org.eclipse.che.plugin.maven.server.core.MavenProjectManager.update(MavenProjectManager.java:147) [che-plugin-maven-server-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at org.eclipse.che.plugin.maven.server.core.MavenWorkspace.update(MavenWorkspace.java:148) [che-plugin-maven-server-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at org.eclipse.che.plugin.maven.server.projecttype.handler.MavenProjectInitHandler.initializeClasspath(MavenProjectInitHandler.java:45) [che-plugin-maven-server-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at org.eclipse.che.plugin.java.server.projecttype.AbstractJavaInitHandler.onProjectInitialized(AbstractJavaInitHandler.java:60) [che-plugin-java-ext-lang-server-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at org.eclipse.che.api.project.server.ProjectRegistry.fireInit(ProjectRegistry.java:404) [che-core-api-project-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at org.eclipse.che.api.project.server.ProjectRegistry.fireInitHandlers(ProjectRegistry.java:390) [che-core-api-project-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at org.eclipse.che.api.project.server.ProjectManager.updateProject(ProjectManager.java:336) [che-core-api-project-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at org.eclipse.che.api.project.server.ProjectService.updateProject(ProjectService.java:222) [che-core-api-project-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_45]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_45]
at org.everrest.core.impl.method.DefaultMethodInvoker.invokeMethod(DefaultMethodInvoker.java:140) [everrest-core-1.13.1.jar:na]
at org.everrest.core.impl.method.DefaultMethodInvoker.invokeMethod(DefaultMethodInvoker.java:60) [everrest-core-1.13.1.jar:na]
at org.everrest.core.impl.RequestDispatcher.doInvokeResource(RequestDispatcher.java:306) [everrest-core-1.13.1.jar:na]
at org.everrest.core.impl.RequestDispatcher.invokeSubResourceMethod(RequestDispatcher.java:297) [everrest-core-1.13.1.jar:na]
at org.everrest.core.impl.RequestDispatcher.dispatch(RequestDispatcher.java:233) [everrest-core-1.13.1.jar:na]
at org.everrest.core.impl.RequestDispatcher.dispatch(RequestDispatcher.java:128) [everrest-core-1.13.1.jar:na]
at org.everrest.core.impl.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:62) [everrest-core-1.13.1.jar:na]
at org.everrest.core.impl.EverrestProcessor.process(EverrestProcessor.java:120) [everrest-core-1.13.1.jar:na]
at org.everrest.core.servlet.EverrestServlet.service(EverrestServlet.java:61) [everrest-core-1.13.1.jar:na]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) [servlet-api.jar:na]
at com.google.inject.servlet.ServletDefinition.doServiceImpl(ServletDefinition.java:286) [guice-servlet-4.1.0.jar:na]
at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:276) [guice-servlet-4.1.0.jar:na]
at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:181) [guice-servlet-4.1.0.jar:na]
at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91) [guice-servlet-4.1.0.jar:na]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:85) [guice-servlet-4.1.0.jar:na]
at org.eclipse.che.filters.EnvironmentInitializationFilter.doFilter(EnvironmentInitializationFilter.java:54) [wsagent-local-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) [guice-servlet-4.1.0.jar:na]
at org.apache.catalina.filters.CorsFilter.handleSimpleCORS(CorsFilter.java:301) [catalina.jar:8.0.37]
at org.apache.catalina.filters.CorsFilter.doFilter(CorsFilter.java:169) [catalina.jar:8.0.37]
at org.eclipse.che.api.core.cors.CheCorsFilter.doFilter(CheCorsFilter.java:59) [che-core-api-core-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) [guice-servlet-4.1.0.jar:na]
at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:120) [guice-servlet-4.1.0.jar:na]
at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:135) [guice-servlet-4.1.0.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [catalina.jar:8.0.37]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [catalina.jar:8.0.37]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) [catalina.jar:8.0.37]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) [catalina.jar:8.0.37]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) [catalina.jar:8.0.37]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [catalina.jar:8.0.37]
at ch.qos.logback.access.tomcat.LogbackValve.invoke(LogbackValve.java:189) [logback-access-1.1.2.jar:na]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) [catalina.jar:8.0.37]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528) [catalina.jar:8.0.37]
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1100) [tomcat-coyote.jar:8.0.37]
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:687) [tomcat-coyote.jar:8.0.37]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520) [tomcat-coyote.jar:8.0.37]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476) [tomcat-coyote.jar:8.0.37]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_45]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.0.37]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45]
Caused by: org.eclipse.che.api.core.NotFoundException: Can't find parent folder: /hue-scheduler/hue-scheduler-front/aggregator-pom.xml/.codenvy
at org.eclipse.che.core.internal.resources.Workspace.createResource(Workspace.java:808) ~[org.eclipse.core.resources-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at org.eclipse.che.core.internal.resources.File.create(File.java:66) ~[org.eclipse.core.resources-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at org.eclipse.jdt.internal.core.JavaProject.setSharedProperty(JavaProject.java:2061) ~[org.eclipse.jdt.ui-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
at org.eclipse.jdt.internal.core.JavaProject.writeFileEntries(JavaProject.java:2019) ~[org.eclipse.jdt.ui-5.0.0-M6-SNAPSHOT.jar:5.0.0-M6-SNAPSHOT]
... 74 common frames omitted

I think the jdt-extension is not being able to create '.codenvy' folder for aggregator pom

Expected behavior:

Should be able to import the maven project.

Observed behavior:

[Exception]

Che version: nightly but happens in 4.7.2 also
OS and version: Ubuntu 14.04
Docker version: 1.12.2
Che install: Docker container

Additional information:

  • Problem started happening recently, didn't happen in an older version of Che: [Yes/No]
  • Problem can be reliably reproduced, doesn't happen randomly: [Yes/No]
@TylerJewell TylerJewell added the kind/question Questions that haven't been identified as being feature requests or bugs. label Oct 24, 2016
@TylerJewell
Copy link

@vparfonov - can you ask a couple of our maven plugin guys to take a peak at this, please?

@KakashiMamun
Copy link
Author

@riuvshin @azatsarynnyy can you guys look at this please ?

@KakashiMamun
Copy link
Author

KakashiMamun commented Oct 24, 2016

I had another query, is there any way to add mirror to your maven server plugin implementation. It seems eclipse che ide is unable to find my dependencies located at private nexus

@TylerJewell
Copy link

We generally suggest that people modify their settings.xml in their workspace. Some include it in their dockerfile. Are you thinking of another approach?

@KakashiMamun
Copy link
Author

KakashiMamun commented Oct 24, 2016

No its not about that. I changed my conf/settings.xml and i can build my project from terminal using build commands. But in the IDE it doesn't get the dependent jars in classpath. I assume it may have soemthing to do with the maven server plugin. Can you tell me how the maven plugin resolves any dependacy jar and add it to the class path ? I will apretiate if you tell me which file i should look for the implementation of resolving dependency . Thanks in advance

@TylerJewell
Copy link

One of @vparfonov @azatsarynnyy or a member of the IDE team will get back to you. The maven plugin should automatically detect all dependnecies and download them. If it is not, then it is a bug. I've asked the engineering team to look at your particular pom.xml in the upcoming sprint. Can you post details of that online?

@KakashiMamun
Copy link
Author

Thanks for your response. There were 2 bugs.

  1. The Maven Plaugin didn't download jar from our private nexus server.

cause: We add the mirror in the M2_HOME/conf/settings.xml which is global setting for Maven but in the mavenserver plugin it only considered user setting. so i fixed the fucntion like this

` public MavenServerWrapper createMavenServer() {
return new MavenServerWrapper() {
@OverRide
protected MavenServer create() throws RemoteException {
MavenSettings mavenSettings = new MavenSettings();

            //TODO add more user settings
            mavenSettings.setMavenHome(new File(System.getenv("M2_HOME")));
            // Setting user settings
            mavenSettings.setUserSettings(new File(System.getProperty("user.home"), ".m2/settings.xml"));
            // Setting Global maven setting
            // for more maven info settings visit https://maven.apache.org/settings.html
            mavenSettings.setGlobalSettings(new File(System.getenv("M2_HOME"), "conf/settings.xml"));

            mavenSettings.setLoggingLevel(MavenTerminal.LEVEL_INFO);
            if (localRepository != null) {
                mavenSettings.setLocalRepository(localRepository);
            }
            return MavenServerManager.this.getOrCreateWrappedObject().createServer(mavenSettings);
        }
    };
}

`

N.B. Still having problem to download some jars which have SNAPSHOT version rather than normal version

  1. About the error in the error stack above, I found collectModulesNameAndPath(MavenModel model) in MavenProject.java file create wrong path for <module>scheduler-front/aggregator-pom.xml</module>

this type of module declaration should handle differently

@vparfonov vparfonov added kind/bug Outline of a bug - must adhere to the bug report template. and removed kind/question Questions that haven't been identified as being feature requests or bugs. labels Oct 26, 2016
@vparfonov
Copy link
Contributor

IDE team will investigate it on next sprint

@KakashiMamun
Copy link
Author

Thank you Mr. vparfonov . I solved the issue (It seems to be solved but i am not sure if it's properly solved) by modifying MavenProject.java

` private Map<String, String> collectModulesNameAndPath(MavenModel model) {
Map<String, String> result = new HashMap<>();
String projectPath = project.getFullPath().toOSString();
if (!projectPath.endsWith("/")) {
projectPath += "/";
}

    //TODO resolve relative path in module
    for (String name : model.getModules()) {

        // Fix for module with custom pom xml
        // like <module>scheduler-front/aggregator-pom.xml</module>

        if(FilenameUtils.isExtension(name,"xml")){
            result.put(name, projectPath + FilenameUtils.getFullPathNoEndSeparator(name));
        }else {
            result.put(name, projectPath + name);
        }
    }
    return result;
}

`

Please check if it's correct way and let me know. Thanks for your help

@vparfonov
Copy link
Contributor

@KakashiMamun nice we want to do something like this. Thanks

@evidolob evidolob self-assigned this Dec 19, 2016
@evidolob evidolob added the status/in-progress This issue has been taken by an engineer and is under active development. label Dec 19, 2016
evidolob pushed a commit that referenced this issue Dec 21, 2016
…tions

Signed-off-by: Evgen Vidolob <evidolob@codenvy.com>
evidolob pushed a commit that referenced this issue Dec 21, 2016
Signed-off-by: Evgen Vidolob <evidolob@codenvy.com>
evidolob pushed a commit that referenced this issue Dec 22, 2016
* #2866 handle relative path and including 'pom.xml' in modules declarations

Signed-off-by: Evgen Vidolob <evidolob@codenvy.com>
@evidolob evidolob removed the status/in-progress This issue has been taken by an engineer and is under active development. label Dec 22, 2016
JPinkney pushed a commit to JPinkney/che that referenced this issue Aug 17, 2017
…dules (eclipse-che#3457)

* eclipse-che#2866 handle relative path and including 'pom.xml' in modules declarations

Signed-off-by: Evgen Vidolob <evidolob@codenvy.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Outline of a bug - must adhere to the bug report template. sprint/current
Projects
None yet
Development

No branches or pull requests

4 participants