IntelliJ - Project tab only shows .gitignore file and not project structure - java

I have a problem with my IntelliJ project. After adding VCS to my project, the project structure in the "Project" tab is not visible any more.
Here is what it looks like right now:
Other projects work fine and everything is visible (eg. "src" folder, .java files...)
Can someone help?
Thanks

You have deleted the intellij workplace hidden xml files
You'll need to import project again to intellij
Creating a project by importing the sources from Bnd/Bndtools, Eclipse, Flash Builder, Gradle, or Maven
1.If no project is currently open in IntelliJ IDEA, click Import Project on the Welcome screen. Otherwise, select File | New | Project from Existing Sources.
1. In the dialog that opens, select the directory or file which you want to use as a source of import. This may be a directory that contains the corresponding collection of sources or a file that appropriately describes such a collection. (The possible choices are listed right in the dialog.) Click OK.
2. On the first page of the wizard, specify the origin of the sources. (This page is not shown if IntelliJ IDEA has guessed what you are importing.) Select Import project from external model, and select Bnd/Bndtools, Eclipse, Flash Builder, Gradle, or Maven. Click Next.
Ref:https://www.jetbrains.com/help/idea/creating-a-project-by-importing-existing-sources.html

Related

Deleting Java project and then creating the same one in the same directory - Eclipse

I'm having difficulties creating a Java project in Eclipse on the same location where the deleted project was. What happens when I change the new project location to the one where the old project was is all my options become grayed out. I cannot select the JRE or change the project layout. I cannot pick whether I want to create module-info.java file or not. It seems like Eclipse somehow knows there was a project on the same location. If that is the case, how can I delete Eclipse Project creation history?
New Java Project dialog info message:
The wizard will automatically configure the JRE and the project layout based on the existing source.
When you delete a project in Eclipse, you get a dialog like this:
As you can see, the default is that the project content is not delete, only the project registration in Eclipse.
Since the actual project files are left on disk, you can "import" the project back into Eclipse, using File > Import....
When you try to create a new project, but select a folder on disk that already contains a project, the "Create Project" dialog automatically becomes an "Import Project" dialog.
If you don't want to import that project, either select another folder, or delete the folder first.
Next time you delete a project, check the Delete checkbox, so all the project files and source files are deleted too.
Make sure you have deleted all the hidden files in the directory.
Make sure it's deleted on your machine in your file explorer. If it's not deleted correctly it can still be save on your machine.

NetBeans, why do some projects appear as coffee-cups and others as folders?

I'm working in NetBeans 6.8 and I want to add projects that I had previously deleted from NetBeans workspace but not from my computer. Some appear as coffee-cups and can be opened fine but others appear as folders and cannot be opened. How can I open these projects (see image).
The Delete action on a project states "This will delete project Xyz so that it cannot be opened in the NetBeans IDE anymore.", which explains the situation. It removes the build.xml file and the nbproject directory from the project directory, rendering it unrecognizable.
You'll need to make a new project, and use the Java Project with Existing Sources as a project type in the dialog.
Specify the project name again, and set the Project Folder to the existing project folder. Then specify the src directory.
Note: All your extra libraries and JARs are lost, you'll have to re-add them to the project.
Next time just Close the project to hide it in the Projects tab.
open Netbeans
file-> new project
from categories -> java and from projects choose "java projects with existing source" -> next button
give any new name to project and choose some different location ->next
"Existing sources" dialog box will come then press button "ADD folder"
choose java project folder

How to rename / move a project in Intellij Idea 12?

As stated here one can change the name of a project. However, it only changes the name of the project and it will not change the folder structure.
As an example if your project is called sample1 and it resides ~/user1/development/IdeaProjects/sample1, the folder location won't be changed to ~/user1/development/IdeaProjects/sample2 if one changes the project name to sample2.
Right click on project, then Refactor -> Rename... (shift+F6), set desired name
Close IntelliJ
Rename directory in your filesystem to your desired name
In startup dialog select Open (or File -> Open... in main window)
Please select renamed project directory
Enjoy, it work's for me!
It seems that one has to right click on the project (after following the instructions to rename the Project), then choose Refactor -> Move to relocate project to the new location. I didn't find any solution to rename and move a project at once.
Close IntelliJ
Rename the folder in Explorer (Windows) / Finder (OSX)
Open IntelliJ
Import Project from Dialog, or File -> Import Project
Select the folder with the new name
Follow the dialogues
I know that probably I won't be able to help sheidaei after more than 7 years from asking question, but I hope that someone will find it useful :)
To change project directory name of a current project without closing Intellij, choose view of "Project Files" in drop-down menu in the project browser(typically on the left) instead of "Project".
How to select "Project Files" view in project browser
Then use right-click on project's directory name/path to open context menu.
Use Refactor->Rename.
Finding option "Rename" in context menu
Type in a new directory name, apply changes using button "Refactor" and that's it.
"Rename" dialog box
If you wish to change Module Name to match directory name, use Refactor->Rename option on project name in "Project" view of project browser.
If it is a gradle project, instead of renaming it using Refactor->Rename :
set the rootProject.name variable in the settings.gradle file to the new project name.
reimport the project. Hit the 'Refresh all Gradle Projects' button in the Gradle Tool Window.
Then follow steps 2 to 5 in #Dawid's answer.
To remove the old project from IntelliJ's list of managed projects:
select File->Open Recent->Manage Projects..
click the 'x' next to the old project name
Go to File then Project Structure
Under Project Settings -> Project make sure that you change the project name.
Then under Project Settings -> Modules change the name there as well.
Restart Intellij
Use your File Explorer to confirm that the project/modules have been renamed.
After renaming the project folder of a Kotlin project in IntelliJ, using the Import Project option as suggested in the other answers created module related problems for me. I was not able to select Main class in the Run dialogue. To solve this, I used Create New Project option. It doesn't delete your project files.
So to rename the folder, first create a copy of your project for safety and then follow these steps:
Close IntelliJ.
Go to file explorer and manually rename the folder.
Open IntelliJ.
Choose the option Create New Project
Select your desired language/framework e.g. Kotlin, click Next
For Project Name, specify your desired project name. Maybe same as folder name.
For Project Location, choose the folder that you manually renamed.
Click Finish, IntelliJ will ask if you want to overwrite .idea and .iml files. Click Yes for both.
Hope that helps.
For JetBrains v. 2019.2 (September 2019):
To move project directory without changing it's name:
Press Alt+1 to open project structure
Right click on project directory
Go to File -> Refactor -> Move directory
OR
Left click on project directory
Press F6
Specify target parent directory and hit OK.
To rename project directory:
Press Alt+1 to open project structure
Right click on project directory
Go to File -> Refactor -> Rename...
OR
Left click on project directory
Press Shift+F6
Select Rename directory (actually it's already selected) and hit OK.
Specify new directory name.
If you need both to move project directory and to change it's name, then do the steps one after another.
After you've done renaming/moving, close the project and remove it from the recent projects list (it became non-functional and you won't need it anymore there).
Then hit "Open" and find the project directory at it's new location. Now you have your project directory moved!
The last two steps should be done with a command like Edit project or something like that, where you can directly specify project directory, but as there is no such command, you need to remove project and reopen it at it's new location instead.
A work-arround for this, if you get an error when click "projectPackage" -> Refactor -> Move, is to close Intellij, move the folder manually, and then in:
C:\Users\user.name\ .IntelliJIdea2019.1\config\options
edit the file recentProjects.xml like this, with you new path, save and close, re-open jetbrains ide and it's done.
Well, I have figured this out and I will write down a step by step guide to how to rename the project directory linked to a GitHub repo.
Situation:
Windows 10
IntelliJ project is linked with a GitHub repo
I want to rename the GitHub repo and the project directory name and keep all my work the same.
Solution:
rename the repo on GitHub, make sure pages is still working with the new name
rename the project from IntelliJ by (right-click on the parent directory -> refactor -> rename)
rename the directory from IntelliJ by (right-click on the parent directory -> open module settings -> project)
3.1. update "project name"
3.2. update project compiler output
rename the GitHub remote repo from IntelliJ by (VCS -> git -> remotes)
close IntelliJ
open System Explorer
6.1. rename the project directory
6.2. open "workspace.xml" and rename all occurrence of the old word (you might want to cut it in another place, update it, then paste it back)
open IntelliJ and select import project
now, everything is okay, you can use Git inside IntelliJ normally as nothing has happened!
That is it, I just made a push from IntelliJ to the renamed repo and everything works as before without any mention of the old name.
click on your project file,which is you want to move and then push F6
Close IntelliJ
Rename the folder in Explorer (Windows) / Finder
(OSX)
Open IntelliJ Import Project from Dialog, or File -> Import
Project
Select the folder with the new name
further additional steps might be required if you see your module named
as new_modulename[parent module/old module name],
then update
settings.gradle with new name and reimport

Where is "create project from existing source" in eclipse Indigo?

I cannot find "create project from existing source" in Eclipse Indigo while I am trying to create a "java project". When I select Java project and then next window comes up with options-
User default location,
JRE,
Project layout, and
Working sets.
I couldn't find a clue while searching for any possible change in UI of Indigo. Where can I find "create project from existing source" in Indigo?
Un-check the Use Default Location option and then Browse to select the parent folder of your existing source tree. Eclipse will automatically detect the existing files and folders, although you might have to configure the project to let it know what your source folder is; but the New Java Project wizard presents that option to you.
If your source directory is inside the current workspace, ERiz's answer won't work due to a bug in Eclipse. (It prints out the error "folder overlaps the location of an existing project"). Instead, you should leave Use Default Location checked and type in the name of the folder as your project name.
See here for more discussion about the problem.
So far it seems the only way to do this is the solution Antimony suggested.
If you want to avoid typing in the folder name, untick "Use default location", select your source directory, then tick "Use default location" again and the Project name field should contain the name of the source directory.
I came across this answer trying to import a Git project, so I will write my solution here.
The workspace directory is the same as the Git's working directory, so I didn't want to move the project folder somewhere else.
If you have a Git project you want to import, but Eclipse can't see it because it has not the .project file in its directory, here's the steps:
File > New > Java Project: put in the name the name of the project's dir, so as Antimony said, the project will be automatically configured.
You will see your project in the Project list, but it's not bound to Git yet.
If it's a maven project, you can convert it to maven project now: right click on the project and select Configure > Convert to Maven project.
Delete the project (DO NOT SELECT "Delete project from disk")
Now you can import the project as a Git project from File > Import > Git Project

loading a java project

I am currently studying at university and based on other peoples recommendations I am beginnning to read other peoples code.
i have found and downloaded the source for an open source java project, that seems quite interesting. I want to load this project into an IDE (netbeans or eclipse), so as to make it easier to read and navigate. However both IDE's say that the project is not recognised. It is not only this project, but any project I have attempted to load.
How do I load a project (ie. a file structure of source files) into the above IDE's as a project.
Thanks in advance,
Sam
In Eclipse, select File, New, Java Project, give the project a name and then select Create Project from Existing Source. You should then select the src folder that contains the code that you'd like to use.
Eclipse should then create a new project containing the source. To change the project settings e.g. source folders/external jars, right click on the project in the Package Explorer and select Properties, Java Build Path, Source and make any appropriate changes.
Actually there is a cool trick with Eclipse, you should be able to just select the class that you are interested (select all of the text from your browser), and just paste this in Eclipse right on top of a project, it will automatically create a class for you. It's very handy when working with SWT snippets for example.
You need to have created an Eclipse project first. But you can just create one project and put any number of classes in it.
If the open source project in question uses Maven as the build system (i.e., there is a pom.xml file in the root of the project) and you have Maven installed, you can run 'mvn eclipse:eclipse' to build the project files for eclipse to use. Then just use File > Import and select existing project into Workspace and point it at the root of the project folder. Eclipse should then import the entire project with the appropriate libraries. There are also plugins that work for NetBeans and Idea I believe.

Categories

Resources