Rename Package with Sub-packages in netbeans - netbeans-7

I Know this seems absurd to ask but I can't seem to get around renaming a package in Netbeans that Have sub-packages. ideally when I right-click and refactor > Rename it renames only the node on the Top. If I try to refactor the Next Node in Line, I get the Error that :
Package already Exists
Does anyone knows how i should go about renaming my main package containing other packages and sub-packages in Netbeans? I am using netbeans 7.2.1.

Using Netbeans 7.3 and assuming your project has the following structure:
my.package.test.subpackage1
my.package.test.subpackage2
my.package.test.subpackage3
You want to rename test into tests.
Go to the NetBeans Files window (Ctrl + 2 or using the Window -> Files menu). Left-click on the folder corresponding to the package you want to rename (i.e. test).
Type F2 and rename it.
All the sub-packages should have been moved to the new directory and all the related package and import statements should have been updated.

Related

Robot Framework- I Rename the Project name and directory name , after that, getting invalid error in python interpreter

Steps followed by me-
In Pycharm I created a project ENT and developed a robot framework for my Application- It already has many test cases
Now because of some requirement, I had to change the name of the project.
So i refactor the project name by right click on the project and also I went to the directory and rename the folder from ENT to ENT_Admin.
Now I am getting error in all the keywords. when I went to file -- setting- project --python interpreter, i am getting error there.
invalid python 3.9 ENT.
please help me with the solution
Try some solution from here
Modify a Python interpreter
Press Ctrl+Alt+S to open IDE settings and select Project | Python Interpreter.
Expand the list of the available interpreters and click the Show All link. Alternatively, click the (cogwheel icon) and select Show
All.
Select the target interpreter and click Edit.
You can specify an alternative interpreter name for the selected
interpreter. The Python interpreter name specified in the Name field,
becomes visible in the list of available interpreters. Click OK to
apply the changes.
For remote interpreters (that are available in PyCharm Professional)
you can modify configuration parameters.
If this doesn't help try to create a new project and import your already renamed project. If your project contains some hidden folder like ".idea" delete it before importing.

How do I rename my entire project in IntelliJ without having so many manual steps?

I have IntelliJ 2019.2
I occassionally mis-name my project during creation.
I have to quit IntelliJ, renaming the folder, opening project again and renaming package and project module manually as well.
Any way to improve this?
Please follow the discussion on the issue: Renaming a project in IntelliJ IDEA
There are project, module name, name in file system etc that can all be different and can be renamed. Rename of folder can be done in file system, project, module rename in the Project Structure settings.

how to export intellij project

I simply want to export my java intellij project from one pc to another, no need for git because I only want to test something on the other pc because it has more memory.
Surprisingly no information on this is available, there is information on how to export a project to a jar file, but I cannot import from this jar file. On their website : https://www.jetbrains.com/help/idea/2016.3/import-existing-sources-project-name-and-location.html they don't give any clear instructions on how to do this simple operation? how is this done?
Till version 2016.3.4 IntelliJ doesn't provide such facility.
Best way to do so would be to copy the whole directory containing your project or module. Doing this would retain all your project related settings.
With the latest version of IntelliJ IDEA, all you need to do is unzip the project in the new computer and then select Open in the IntelliJ IDEA new project wizard. Do not use the option to import the project from the zip file, as that doesn't work.
Take all directories of your project and copy them into the other computer. Launch IntelliJ and open the folder of your main directory project, that is all it needs to work (*.iml files do all stuff for you). If you don't know what directory is the main, you can close the project in your other IDE and see what paths it is catching. For example in my case:

Play Framework 2.4 and IntelliJ Idea

I am trying to open a play 2.4 project in IntelliJ but since things have changed I don't know how to do this.
In previous versions I could just run
activator idea
Or use the activator UI and click on generate intelliJ project, but in 2.4 the idea command doesn't seem to exist
[error] Not a valid command: idea (similar: eval, alias)
[error] Not a valid project ID: idea
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: idea (similar: clean)
[error] idea
[error] ^
And the UI seems broken, when I click on generate intelliJ project it tries to compile the app and gives this error:
play/Play$
java.lang.NoClassDefFoundError: play/Play$
Use 'last' for the full log.
Failed to load project.
I created the project from scratch using the play java template with:
activator new
I have also tried importing the folder as a project but intelliJ doesn't seem to identify it as a project
I run into the same problem, as I used IDEA to open a project folder, it had an play 2 app in a sub folder, then I import module (play 2 app) to the system.
And it works well.
After that I have changed the module folder name, then when I run the app, it displayed:
Not a valid project ID: "project team"
I re-checked the folder, and found that in the File -> Project Structure option, the name of module is "root", and the "team" is the module for whole project (not the module imported by SBT), so apparently, the module wasn't functional after I changed the module folder name.
So I found and removed all .idea folder, which is IDEA configureation, then re-open/re-import the module, still not work. I thought it's IDEA cache issue, it do have cache for the opened project, so I changed the project folder from team to something else, clean the .idea folders, and re-open/re-import it. It worked.
If the play app is in the project folder as a sub folder, to import the module at File -> Project Structure.
The project name should be "root" when running it in IDEA. So in this case, you should rename "project team" to "root" in the name field.
Solution 1
In my case (IDEA 2018.2), I changed the lazy val variable in build.sbt, it had the name "root" when my project name was "top", changed "root" to "top".
Before:
lazy val root = (project in file(".")).enablePlugins(PlayScala)
After:
lazy val top = (project in file(".")).enablePlugins(PlayScala)
Change project variable
Solution 2
The method proposed by Tom solved my problem partially, because after rebooting the IDEA I returned the project name back, it was necessary to change the variable from "top" to "root" in build.sbt.
Before:
name: = "top"
After:
name := "root"
Intellij IDEA lets you quickly create a Play application without using a command prompt. You don’t need to configure anything outside of the IDE, the SBT build tool takes care of downloading appropriate libraries, resolving dependencies and building the project.
Before you start creating a Play application in IntelliJ IDEA, make sure that the latest Scala Plugin is installed and enabled in IntelliJ IDEA. Even if you don’t develop in Scala, it will help with the template engine and also resolving dependencies.
Basically, install Play Framework, Scala plugins and import project into Intellij as SBT project. Don't use activator to create IDEA project files. More details here.
It seems I had not updated scala/sbt to the latest version in intelliJ
Once I had done this it noticed that it was a valid project, though the docs don't seem to mention you can import it as an SBT project, just how to create it as a new sbt project (which I did not want to do as I wanted to create it via activator)
I also had the project/play-fork-run.sbt file issue
I use Intellij Idea 16.3.3 and this problem appears sometimes. How I fixed it? You just need to open your SBT plugin and under your project get the context menu then you should choose "Ignore SBT project". After a current process is finished you should turn on this option again. This is work for me:)

How to open and edit multiple projects in the same window?

I build in maven multiple projects (let's name them A,B,C). Project A uses .jar of project B which uses .jar of project C.
I am modifying the code of all A/B/C projects, (A is MVC app, B are business services and C is some shared layer).
The thing is, in Eclipse/NetBeans I can see all of them at once and it's comfortable to modify them. In IDEA though, I have to open 3 instances (or n instances) of IntelliJ IDEA.
Am I missing something? Is there better approach when using IntelliJ? This is the biggest downside of IntelliJ for me atm.
I think this has improved with recent versions of IntelliJ. In my current version (12.0.2), you can add any number of separate Maven projects to the same "workspace".
The simplest way I've found to do this is to click the little + icon in the "Maven Projects" window (View > Tool Windows > Maven Projects) and then select the additional pom file you want to import.
Step 1: open "Maven Projects"
Step 2: select the project you want to import:
Prequisite
Having all the related projects in the same root directory
can be helpful.
Steps
1) First you create a new Empty project
2) Then you select the root directory of all your projects.
This will create a empty project, with a .idea directory that will simply remember the module organisation we are about to do in the next step
3) Then, in the next window, you import the different projects as modules
4) In the next window, to import each project, simply double click on the build.gradle, or pom.xml
The project will be imported as a new module.
5) Done, you now have all your projects as modules, opened on the same IntelliJ project
Yes, your intuition was good. You shouldn't use three instances of intellij. You can open one Project and add other 'parts' of application as Modules. Add them via project browser, default hotkey is alt+1
In IntelliJ 14.1.2, I did it like following:
Select File->Project Structure->Modules.
Select + and Import Module and select the directory of your project(or directory where pom exists) and click OK.
Follow through the next flow of screens and after you click Finish, you should see the project alongside your existing one.
None of the solutions worked for me, since I am not working on Maven projects. There is a simpler solution. Go to:
File->Project Structure->Modules.
Instead of adding module, simply click the third option (copy). Browse your local directory and select the project you would like to add. Module name will resolve automatically. That's it.
Update: When you want to reopen to project with multiple sub-projects, in order to avoid re-doing steps as described above, just go to
File->Open Recent->'Your Big Project'.
Since macOS Big Sur and IntelliJ IDEA 2020.3.2 you can use "open projects in tabs on macOS Big Sur" feature. To use it, you have to enable this feature in your system settings:
System Preferences -> General -> Prefer tabs [always] when opening documents
After this step, when you will try to open second project in IntelliJ, choose New Window (yes, New Window, not This Window).
It should result with opening new project in same window, but in the new card:
To expand #Neo answer:
after choosing your directory. select import module from external model and choose your model (maven in this case).
Then check keep project files option from next dialog. It will keep all files in original directory.
Your final project structure would be something like this.
Now you can add your module as dependency to other module's pom.xml and if you change the source code of your dependencies, Intellij takes care of updating your project (there is no need to run mvn build manually for dependencies)
new empty project
File -> New -> Module from Existing Sources
For who uses Gradle can also avail the same:
Go to:
1. View --> Tool Windows --> Gradle
2. Click on the + button and add your build.gradle file
Open preference -> appearance & behaviour -> System settings -> select (open project in new window) then apply.
Then you could open and edit multiple projects.
You can use Armory plugin which makes switching between projects comfortable. The default shortcut for Project List is Alt + A.
By default currently opened projects are displayed at the top of this list (with bold style).
Use the button for the add maven projects and go inside the folder of the project. Then, select the pom.xml file and add them in the IntelliJ.
Press "F4" on windows which will open up "Project Structure" and then click "+" icon or "Alt + Insert" to select a new project to be imported; then click OK button...
To Intellij IDEA 2019.2, F4 + click on module, click to + for add any project from your HDD, above this menu yo can edit the IDE with you create the project and more options, very easy
For people not using maven to build and wanting to add a new project (I am using intellij 14.1.3):
Right click the top level folder in the project view, select new ->
Module
Name the module the same name as the project to be added
From the top menu select File->New->Project. Enter the same name as
the new module, same folder locations as well.
Open the Project, and wait for intellij to create the project
structure.
Close this new project, and open the original project the module was
added to in step 2
Depending on your builder, additional steps will be needed to add it to the build process.
For SBT, and in the top level project I modified the Build.scala file to aggregate the new project, and added the project in the SBT projects window. More info on SBT multiproject builds: http://www.scala-sbt.org/0.12.2/docs/Getting-Started/Multi-Project.html
"IntelliJ IDEA 2022.1.1 (Community Edition)" you have to navigate
To Add Exiting Module to same window navigate "File -> New -> Module from Existing Sources" then it will allow you to select pom.xml and then click "Create" button next window then project will be added to your current workspace.
Note :: Who ever switches from Eclipse to Intellij this is the first problem
Assuming they are under the same folder, click File-Open File or Project-<parent folder>.
you can use import module option which will open it just like eclipse in the same navigator.
For IntelliJ Idea 2021.3.3 users, The below solution didn't work for me, although I was selecting my project main folder, I've gotten only the main and test folders imported!
Peoject Structure => Modules => Import module
The solution is:
view => tool Windows => Maven => click the + icon => add the project POM.xml file
I am new to maven and did not understand how I could work with local maven project added through Viktor Nordling's answer and still have a proper dependency in pom.xml file. The answer is simple: intellij first looks at your locally added module and if it doesn't find one it goes to get the project remotely. You can check this by looking at "external libraries" under your project browser when you add or remove maven module.
Hope this helps anyone.
As of release 2019.2, this is as easy as File->Attach Project.
🎉🎉🎉🎉🎉
See: https://youtrack.jetbrains.com/issue/WEB-7968
After importing project into IntelliJ, Go to pom.xml of each module -> right click -> Click on Add as Moven Project. It will add the module as Moven project, do this for all the modules in the Project. Refer this