IntelliJ IDEA project modules are not auto identified on WSL - java

The files within my Gradle project are not identified by IntelliJ when a project in WSL (Windows subsystem for Linux) is opened by IntelliJ IDEA Ultimate. Correct java versions are also installed within WSL and the paths are also set correctly.
This is a Gradle project and my java files are shown with a red icon on them and it says "Java file outside of source root".
Then I went to File -> Project Structure -> Modules, and observed that the correct modules were not identified.
When I open the same project in Windows or Ubuntu, the modules are automatically detected and I don't need to add them manually.
How I opened the project is using File -> Open on IntelliJ for Windows and gave the project path within WSL (E.g. \\wsl$\Ubuntu-20.04\home\username\idea-project).
My Gradle versions is as below,
Has anyone come across any situation like this that could help me figure out what is the issue behind this.
Thank you.

Related

No Java code completion in VSCode in gradle project

I am trying to setup my VSCode to get proper code completion in this project: https://github.com/structurizr/java-extensions
I have the Java Extension Pack installed in my VSCode.
But it is not even recognized as a Java project. If I add every single "src" folder via "Add folder to java source path" the Java imports are recognized but the code completion is still not working.
Any hints on what is wrong or what I need to configure in my VSCode to make it work?
Thank you
Because this is a Gradle Project, In addition to Java Extension Pack, you should install Gradle Language Support.
Then reopen the project in VS Code, Gradle extension will download the required files to be able to build and compile the project. After all downloads finished, you can edit your project and auto-completion would work as normal:

How do I "export" this Eclipse plugin from sources?

I'd like to use this Eclipse plugin:
https://marketplace.eclipse.org/content/opencl-development-tool#group-details
with my Eclipse 2019-09. But - there's a version incompatibility, or so I'm told. It's been suggested to me that I might be able to use the plugin sources to "export it yourself as a deployable in order to install it".
But it's not at all clear to me how I'm supposed to do that. I'm not fluent with building Java artifacts nor with Eclipse plugin development and deployment. At the link above, there are several repositores, and most of them are only two or three files, one of them being pom.xml. Only one seems like a proper repo (this one).
What do I do with these repos and how can I make a plugin I can install in Eclipse, using them?
Looks like it's become simpler over time--there's a wizard with options for doing this once you've got the plug-in in your workspace compiling cleanly. Install the Plug-in Development Environment for your version of Eclipse. It should be in an update site already in your list of Available Software Sites (that's a preference page). Then, follow the steps of the Export and Install into the Running Host task in the built-in Help. The first 3 sentences of that task refer to the normal process of debugging plug-ins from source projects in the workspace. The rest of it is a guide to exactly what needs to be done here.
Here's the link to the 2020-03 version of that documentation:
https://help.eclipse.org/2020-03/topic/org.eclipse.pde.doc.user/tasks/ui_export_install_into_host.htm?cp=4_2_4_0
And the relevant parts:
...it is sometimes necessary for code to be tested in your host, your currently running Eclipse instance. To test code in the host, you need to export and install into the running Eclipse instance.
To export plug-ins and features and install them into the host Eclipse do the following:
Develop your plug-ins and features in the workspace
Open the export wizard, either Open the plug-in export wizard File > Export... > Plug-in Development > Deployable plug-ins and fragments or Open the feature export wizard File > Export... > Plug-in Development > Deployable features
Select your plug-ins or features to export and install
Select the last option on the Destination tab Install into host. Repository. Then choose a directory to create the repository in
Hit Finish. The export operation will run followed by the installation operation.
If the operations completed successfully, you will be prompted to restart. Choose to restart now
our plug-ins will be installed and running after the restart. You can see what has been installed using the Installation Details button on the About Dialog (available by going to Help > About Eclipse SDK)

Ant build with Eclipse Mars fails due to missing classpath reference

I recently moved to Eclipse Mars and installed JDK 8u51. I'm using the JBoss Tools plugin with my Eclipse and have a couple of Ant files to build my projects.
When I double-click on a build file in the Ant view, however, my project won't built. Instead I get this error message:
The archive: C:/Program%20Files%20(x86)/Eclipse%20Mars/plugins/org.eclipse.swt.win32.win32.x86_64_3.104.0.v20150528-0211.jar which is referenced by the classpath, does not exist.
I checked the file system and the JAR is actually there. Any ideas how I could fix that? Maybe it's the spaces (%20) in the path name?
Unfortunately, I don't know where this dependency comes from. In the External Tools Configuration it is under Additional Tasks & Support, but I cannot edit the entry there. Nor did I find any other dialog where I can actually configure this reference.
Having had the exact same issue with Eclipse Mars, it turned out the problem was related to the '%20' stuff and not to the jar in itself.
You can either work on a different folder than "Program Files" (install eclipse somewhere else, ...), or create a symbolic link so that ant can see the existing repository the way it knows it. Run the following command in the elevated command prompt(Start > Type cmd > Right click and Run as administrator)
mklink /d c:\Program%20Files%20(x86) "c:\Program Files (x86)"
(and the same for "Eclipse Mars" directory, that you could also rename to remove the space)
Only need to remove blank spaces in the directory name.
Eclipse 4.5.1 was released on October the 2nd and Bug 470390 has been fixed.
The update resolves this issue.

Import Java Project from Eclipse to NetBeans [duplicate]

Is there a way to share the same *.java files between Netbeans and Eclipse?
You can import an eclipse project into netbeans,
or you can create an eclipse project from existing sources.
Sharing the Java source files is not the problem - just put them into some source control system, and then import them in both IDEs. Usually the configuration, especially the build process, is the main problem.
In practice, the solution is likely that you maintain separate project configuration files for both IDEs, but use a common build script (e.g. ant) that is supported by both. The project configuration allows you to use IDE-specific features, while the build script makes sure that both environments produce the same output.
Of course. eclipse supports linked source folders. The sources files don't have to be located in an eclipse project folder.
Inside an eclipse java project, select New -> Folder, then select "Advanced" and check "Link to alternate location" (eclipse 3.6, may be slightly different on other eclipse versions). "Browse" to choose the source folder from the netbeans project, press Finish.
Now you have linked (standard) folder to the Java files inside the netbeans project and modifying those files will modify them at the remote location.
Finally - right-click on this linked folder and choose Build Path -> Use as source folder.
(I leave the other way round to the netbeans experts)
In the ideal case you have your code stored in a version controlled repository (SVN, CVS, etc.). Then it is not as big of a factor whether you are using Eclipse or Netbeans.
This article, taken from a NetBeans 6.2 version of documentation, explains how you can import an Eclipse project into NetBeans and work with both together. NetBeans will create new project files but will link to the Eclipse source files, allowing sharing between the two. I have not tried this yet myself, but may be going down this path soon. After switching to NetBeans just this week, noticed that a significant feature in Eclipse is not in NetBeans - that of being able to create different run configurations that are not incorporated and stored into the POM. At this point in time, I do not have a solution to the run configuration issue, but if you do, please update the SO question here.

How to use Jsoup in Eclipse

I just downloaded Jsoup to use in a program I'm writing in Eclipse. My program uses Seam and I can not figure out how to include the JAR file for Jsoup in my program. Any help would be greatly appreciated. Thanks
Drop the JAR file in /WEB-INF/lib folder of the WAR, or in the /lib folder of the EAR. Eclipse will do the remaining necessary magic. Don't fiddle with project's Build Path properties or things may go worse.
I did what BalusC recommended above, but I also had to 'refresh' Eclipse in order for the .jar file to be recognized. To refresh, just right-click on the left side window pane within Eclipse and select refresh.
Eclipse Version:
Eclipse Java EE IDE for Web Developers
Version: Kepler Service Release 1
Build id: 20130919-0819
OS: Fedora

Categories