Renaming a project in IntelliJ IDEA
Asked Answered
C

15

128

I have some projects where the directory containing the project is called "Code".

When I open IDEA, in my recent projects list all I see is that name.

Is there any method to change this in settings ?

I tried going to File->Project Structure->Project, I couldn't find the Project Name option in IntelliJ IDEA 13.

This is what I see when I open Project Settings I see this in my project settings.

Chemist answered 17/1, 2014 at 3:50 Comment(4)
Right click on "Code" -> Refactor -> Rename. Is this what you looking for?Determinative
Not really, I want to change what IntelliJ uses as the project name. I can change module names using Refactor -> Rename, but doesn't seem to affect the project's name.Chemist
@PaulVerest it's not the same problem that I was having. Please see my first response to the accepted answer.Chemist
Similar: IntelliJ IDEA: How to rename a project (in "Recent Projects" list)?Kyliekylila
W
159

You can change the project name, which is the name that is shown in the recent projects list, like so:

Go to Project Structure (Ctrl+Alt+Shift+S) → Project Settings / Project → Project name:

enter image description here

Please note that this is not to be confused with name of the root module, or folder on the file system, which may or may not be similar.

Edit

Please try going into your .idea folder in the project, create a file named .name and enter a project name on a single line.

e.g.

my-new-project-name

Then restart IntelliJ.

This presumes you are using a folder-based Idea project in .idea (rather than file based, with .iws file etc)

Wiatt answered 17/1, 2014 at 7:38 Comment(4)
Hi, I don't see that option. I added a screenshot of my project structure dialog.Chemist
Wow, weird screenshot. Project name should be right above Project SdK.... Is this a mac thing?Wiatt
Manually updating the contents inside the .name file also fixed same problem for me in Android Studio 0.8.9Punctilious
also change the project name in settings.gradleDwyer
M
42

Meanwhile I talk about IntelliJ 2016.2.

There are various names involved.

  1. Red the folder name. I.e., the folder where the project is located. This name appears the the project structure and in the path on the top window.
  2. Blue the name of the iml file. You can rename the iml file, when the iml file is different from the folder name, you have them both in the project view.
  3. Yellow the project name can be set as described by @vikingsteve (Project Structure (ctrl-alt-shift-s) -> Project Settings / Project -> Project name) in the response above. You will find the project name written in the file ".name" in the .idea folder. It is also the name which appears in the open recent file list.
  4. brown if your project is a maven project, you will additionally have the artifact id in the pom.

Usually all these names are the same which makes life easier.

Sometimes they are not. There are many reasons why they should be different. E.g., this helps me to differentiate project versions (I also use the image background feature of IntelliJ 2016.2) when I have simultaneously the same project on two branches.

While you change these names, IntellJ may generate a new *.iml with the artifactId name (brown). In this case just delete the *.iml file you don't want to keep.

screenshot

Mm answered 15/8, 2016 at 7:55 Comment(2)
+1 as this helped me solve a different question I didn't know how to explain. The blue circle next to the red circleMonogram
Why are you using iml files and not .idea folder?Wiatt
P
37

Following are the steps to be followed in IntelliJ Idea Community Edition:

  1. Go to File >> Project Structure >> Project > Project Name Update project name with its new name.

  2. Go to pom.xml Update project name with its new name in the

  3. Select "Project" view and click root folder of the project then refactor its name.

  4. Exit IntelliJ Idea and Rename root folder name in the windows directory structure where this project repository is stored.

  5. Restart IntelliJ Idea and import the project using "Import project from existing resource" option.

Pinky answered 8/4, 2016 at 21:28 Comment(3)
This is the only answer that worked for me (reading down from the top). I had no idea you needed to refactor the project name (in 3). It's weird to me that that's a separate thing from the Project Name in Project Structure.Mb
Note that if you just want to change the name of the project, you only need step 1. The IntelliJ project metadata (.e.g, contents of .idea directory, *.iml files) will remain the same. You probably still want to change the project name in your pom.xml to keep things consistent. If you're project is not a Java Maven project, you won't have a pom.xml.Astomatous
I'm surprised this isn't at the top, where it should beNoteworthy
B
17

Tips for renaming a Gradle project

  1. Exit IntelliJ IDEA

  2. Edit contents of the following files {project_root}/settings.gradle {project_root}/.idea/.name

  3. Open IntelliJ IDEA

  4. Refresh Gradle Project

Borodin answered 20/7, 2017 at 3:41 Comment(2)
Thanks for this simple and effective solution!Famine
This is the best answer. Thanks @BorodinRockbottom
H
6

Am using intellij 2017.2.6

  • Go to project view

  • Right Click on the top root element

  • Choose Refactor-> Rename

  • Small dialog appear -> enter the desired name

  • Click ok

image 1

enter image description here

Hayrick answered 11/6, 2018 at 21:58 Comment(1)
Nope, that doesn't work in changing the root folder name or anything else in the project. It just adds the renamed version in block parenthesis.Zenobia
H
5

Actually this is a maven project and its name is defined from the maven pom.xml So if you want to change the name you need to change its name in pom.xml
from

 <artifactId>Code</artifactId>

to

 <artifactId>My-prject-name</artifactId>
Heti answered 15/4, 2014 at 13:56 Comment(0)
R
4

This worked for me:

  1. Renamed module folder
  2. Updated module name in settings.gradle
  3. Updated all build.gradle references
  4. rm -rf .idea/modules/[module]
  5. Rebuild project
Rolanda answered 29/12, 2018 at 18:6 Comment(0)
J
3

intellij project structured in folder

I completed the renaming as below.

The attached image is structured in project folder.

Must make changes in the xml into a new project name.

  1. close IDEA intellij (14.0.2)

  2. change intellij project name (folder)

    e.g) old_project_name -> new_project_name

  3. change .idea in folder

We have only changed the

1) artifacts in folder -> xml

2) runConfigurations in folder -> xml

3) modules.xml

4) workspace.xml

5) [your_project_name].iml

(Depending on your project structure, your folder may not contain xml)

  1. restart IDEA intellij

  2. File -> Import Module...[your intellij project]

I hope this helps you :)

Jemimah answered 13/2, 2015 at 14:5 Comment(0)
L
3
  1. Rename project in project tree view
  2. Rename project folder in project files tree view
  3. Rename artifactId and id in pom.xml (if maven is used)
Larrabee answered 25/4, 2018 at 11:45 Comment(0)
T
2

Once you have changed the project name by following the other suggestions mentioned in this thread, you can also change the module name within the project settings -> Modules:

enter image description here

This will change the name that is included within the brackets just next to the name of the project:

enter image description here

After this, proceed to refactor and rename the class that contains the main method to match your new project name. (This class is normally auto-generated by intelliJ after creating a new project).

That should do it. Cheers!

Tweedy answered 18/8, 2020 at 1:49 Comment(1)
It is possible just to show project module name instead of folder[module], I was able to hide path but in my opinion it is also usefull justo showing the module name and not foder[module]Nonviolence
G
1

If your project is file based, you cannot rename the project from within IDEA.

Convert your project to a directory based format, and then you will have the option to rename it under "File > Project Structure > Project > Project Name".

Gynaecology answered 9/6, 2015 at 23:44 Comment(0)
V
1

For Gradle Springboot intellij project:
1. settings.gradle :
rootProject.name = 'new-name-project'
add/edit the above line at the bottom of the page
2. application.properties
spring.application.name=new-name-project
add/edit the above line at the top of the page
3. Go to file > project stricture > Project> Project-name: new-name-project
4. Apply and restart Intellij

Vouchsafe answered 4/10, 2019 at 14:37 Comment(0)
P
0

I recently figured out a way to do this.

I wrote a bash script that you run from the root folder of your project (only tested on Mac) to rename all of the files in the .idea folder that contain your project name, and do a find-replace inside those files.

BE CAREFUL: Make sure your project name is unique - i.e., a project name like 'towers-of-hanoi' is unique and the script will have no problems, but a project called 'a' will, as all instances of 'a' in the files will be replaced with the new project name.

Pinot answered 1/1, 2017 at 23:15 Comment(0)
W
0

UPDATE IntelliJ 2021.2.3 (complete, including maven)

Covers the project, maven configuration (including multi-module), and file system folder. Eliminates project name in brackets in project view.

  1. Backup your project!
  2. Go to File | Settings | Build, Execution, Deployment and delete all trusted locations. Related to some project security settings. In my case, Maven was broken until I did this and reset my Build Tools | Maven settings.
  3. Go to File | Project Structure and enter new name
  4. In IntelliJ project view: for each module, right-click top level module folder and select Replace in files… Enter current project name in find box and new project name in replace box. Either selectively replace by file or click Replace all
  5. Repeat step 3 for the .idea folder
  6. Exit IntelliJ to file system
  7. Rename project directory to new name
  8. Back in IntelliJ, the project window will open because it can’t find the project
  9. Delete the old project entry (no files are deleted, this is just the recently used project list)
  10. Click Open, navigate to the new directory and click Ok

Notes My run configurations are stored in files and were updated. If not, per Jetbrains doc, they are stored in workspace.xml and should be updated but I did not test this. After my project opened, I rechecked for the old name and there was still one instance in a .idea xml file but this may have been an anamoly. I changed it and restarted IntelliJ just for good measure.

Wendall answered 11/12, 2021 at 18:11 Comment(0)
C
0

I had an issue renaming the project's name following the above instructions. I've tried all of the suggestions, which were very helpful and very well explained. But for some reason (maybe there is something wrong with my computer or IntelliJ installation) my project was still not renamed. I could see the new name actually between [] next to the project's old name in the left pane (i.e: oldName [newName]). I could also see the path being changed in the project's settings. However, the folder name had not changed, and when I tried to open the project in intelliJ, it was still under the old name.

If your case is like mine I found a work-around for it:

  1. Close IntelliJ IDEA.
  2. Rename your folder.
  3. Open IntelliJ IDEA. (You'll see your old project with the old name with a ~ next to it, meaning it's broken or not found).
  4. Click on Open project.
  5. Search for your project under the directory with the new name.
  6. Choose it and click open.

I hope that helps.

Chorizo answered 11/1, 2022 at 17:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.