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

Use location instead of Eclipse workspace path for classpath #10153

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,4 @@ curl -sL ${DOWNLOAD_AGENT_BINARIES_URI} | tar xzf - -C ${LS_DIR}
echo writing start script to ${LS_LAUNCHER}
touch ${LS_LAUNCHER}
chmod +x ${LS_LAUNCHER}
echo "java -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -noverify -Xmx1G -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=4410 -jar ${LS_DIR}/plugins/org.eclipse.equinox.launcher_1.5.0.v20180512-1130.jar -configuration ./config_linux -data ${LS_DIR}/data" > ${LS_LAUNCHER}
echo "java -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -noverify -Xmx1G -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=4410 -jar ${LS_DIR}/plugins/org.eclipse.equinox.launcher_1.5.100.v20180607-1243.jar -configuration ./config_linux -data ${LS_DIR}/data" > ${LS_LAUNCHER}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@
<artifactId>org.eclipse.jdt.ui</artifactId>
<packaging>jar</packaging>
<name>Che Plugin :: Java :: Eclipse JDT UI</name>
<properties>
<dto-generator-out-directory>${project.build.directory}/generated-sources/dto/</dto-generator-out-directory>
</properties>
<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
Expand Down Expand Up @@ -180,6 +187,68 @@
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-api-dto-maven-plugin</artifactId>
<executions>
<execution>
<id>generate-server-dto</id>
<phase>process-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<dtoPackages>
<package>org.eclipse.che.ide.ext.java.shared</package>
</dtoPackages>
<outputDirectory>${dto-generator-out-directory}</outputDirectory>
<genClassName>org.eclipse.che.plugin.java.server.dto.DtoServerImpls</genClassName>
<impl>server</impl>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-resource</id>
<phase>process-sources</phase>
<goals>
<goal>add-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>${dto-generator-out-directory}/META-INF</directory>
<targetPath>META-INF</targetPath>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>add-source</id>
<phase>process-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${dto-generator-out-directory}</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,6 @@
</excludes>
</configuration>
</plugin>
</plugins>
</plugins>
</build>
</project>
72 changes: 2 additions & 70 deletions plugins/plugin-java/che-plugin-java-ext-lang-shared/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,13 @@
<artifactId>che-plugin-java-ext-lang-shared</artifactId>
<name>Che Plugin :: Java :: Extension Java Shared</name>
<properties>
<dto-generator-out-directory>${project.build.directory}/generated-sources/dto/</dto-generator-out-directory>
<findbugs.failonerror>false</findbugs.failonerror>
</properties>
<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
</dependency>
<dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-api-dto</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-commons-gwt</artifactId>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
Expand Down Expand Up @@ -68,18 +55,6 @@
</resources>
</configuration>
</execution>
<execution>
<id>add-source</id>
<phase>process-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${dto-generator-out-directory}</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
Expand All @@ -94,49 +69,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-api-dto-maven-plugin</artifactId>
<executions>
<execution>
<id>generate-client-dto</id>
<phase>process-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<dtoPackages>
<package>org.eclipse.che.ide.ext.java.shared</package>
</dtoPackages>
<outputDirectory>${dto-generator-out-directory}</outputDirectory>
<genClassName>org.eclipse.che.ide.ext.java.client.dto.DtoClientImpls</genClassName>
<impl>client</impl>
</configuration>
</execution>
<execution>
<id>generate-server-dto</id>
<phase>process-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<dtoPackages>
<package>org.eclipse.che.ide.ext.java.shared</package>
</dtoPackages>
<outputDirectory>${dto-generator-out-directory}</outputDirectory>
<genClassName>org.eclipse.che.plugin.java.server.dto.DtoServerImpls</genClassName>
<impl>server</impl>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -420,12 +420,23 @@ public List<String> getResolvedClasspath(String projectUri) {
* @param entries classpath entries
*/
public void updateClasspath(String projectUri, List<ClasspathEntry> entries) {
List<ClasspathEntry> fixedEntries =
entries.stream().map(this::fixEntry).collect(Collectors.toList());
UpdateClasspathParameters params = new UpdateClasspathParameters();
params.setProjectUri(projectUri);
params.setEntries(entries);
params.setEntries(fixedEntries);
executeCommand(UPDATE_PROJECT_CLASSPATH, singletonList(params));
}

private ClasspathEntry fixEntry(ClasspathEntry e) {
ClasspathEntry fixed =
new ClasspathEntry().withPath(prefixURI(e.getPath())).withEntryKind(e.getEntryKind());
if (e.getChildren() != null) {
fixed.setChildren(e.getChildren().stream().map(this::fixEntry).collect(Collectors.toList()));
}
return fixed;
}

/**
* Gets source folders of plain java project.
*
Expand All @@ -437,7 +448,8 @@ public List<String> getSourceFolders(String projectPath) {

String projectUri = LanguageServiceUtils.prefixURI(projectPath);
Type type = new TypeToken<ArrayList<String>>() {}.getType();
return doGetList(GET_SOURCE_FOLDERS, projectUri, type);
List<String> result = doGetList(GET_SOURCE_FOLDERS, projectUri, type);
return result.stream().map(LanguageServiceUtils::removePrefixUri).collect(Collectors.toList());
}

private void checkLanguageServerInitialized() {
Expand Down Expand Up @@ -674,7 +686,15 @@ private List<JarEntry> getLibraryChildren(ExternalLibrariesParameters params) {
private List<ClasspathEntry> getClasspathTree(String projectPath) {
String projectUri = prefixURI(projectPath);
Type type = new TypeToken<ArrayList<ClasspathEntry>>() {}.getType();
return doGetList(GET_CLASS_PATH_TREE_COMMAND, projectUri, type);
List<ClasspathEntry> result = doGetList(GET_CLASS_PATH_TREE_COMMAND, projectUri, type);
return result
.stream()
.map(
cpe -> {
cpe.setPath(LanguageServiceUtils.removePrefixUri(cpe.getPath()));
return cpe;
})
.collect(Collectors.toList());
}

private JarEntry getLibraryEntry(String resourceUri) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.eclipse.che.selenium.core.project.ProjectTemplates;
import org.eclipse.che.selenium.core.workspace.TestWorkspace;
import org.eclipse.che.selenium.pageobject.ConfigureClasspath;
import org.eclipse.che.selenium.pageobject.Consoles;
import org.eclipse.che.selenium.pageobject.Ide;
import org.eclipse.che.selenium.pageobject.Menu;
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
Expand All @@ -37,6 +38,7 @@ public class ConfigureClasspathBaseTest {
@Inject private ConfigureClasspath configureClasspath;
@Inject private Menu menu;
@Inject private TestProjectServiceClient testProjectServiceClient;
@Inject private Consoles consoles;

@BeforeClass
public void prepare() throws Exception {
Expand All @@ -47,6 +49,7 @@ public void prepare() throws Exception {
PROJECT_NAME,
ProjectTemplates.MAVEN_JAVA_MULTIMODULE);
ide.open(ws);
consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME);
}

@Test
Expand Down