Bringing configuration to another computer

已回答

To handle travel I am setting up IntelliJ IDEA on a laptop.  I will eventually return to the desktop but for now my user will be on the laptop.   

NOTE:  I can usually get the job done with IntelliJ, Maven and GitHub but am not an expert.  I am very likely missing quite a bit of important knowledge.

Already done:

- Installed IntelliJ Ultimate 2023.3.2 on the laptop.  Working fine.   Already setup the config so that it recognizes the same user for both PC and laptop.  No apparent issues.  The PC is still on 2023.2.3.

- Since the project was a Java Maven project using GitHub, I already cloned the project to the laptop.  It seems to have pulled all of the code.

Things I noticed (so far) that are different:

1) My project uses nested POMs to build various modules, some of which execute as standalone SpringBoot apps, some run as REST services on a Tomcat server, and some are webapps running on that Tomcat server.   Curiously, while on the original PC the Maven (top right) panel only shows the top modules of my project unless I expand them and then they show sub-modules… on the laptop the list shows every module instead of being nested.  QUESTION:  Not a big deal from a usage standpoint (so long as the modules are still built in order when I do a build from the main project) but I wonder… can this have some negative side-effect?  If yes, how do I fix it?

2) The .gitignore file did not carry over.  QUESTION:  Again it is no big deal to copy the file manually, but… what other things could have been skipped that I need to copy manually?

3) Configurations did not carry over.  Makes sense since they are part of IntelliJ IDEA and not the project code.   QUESTION:  Is there a simple way to copy them over?  Or do I have to recreate them one by one?

4) I am sure that I need to reinstall plugins that I used on the old PC into the laptop.  QUESTION:  Is there a simple way to find out which plugins to install?

And of course… is there anything I haven't noticed that I should pay attention to, in order to ensure that the laptop IDE will behave exactly like the PC one?

 

Sorry for the long post, and thanks in advance for any advice.

0

1. Make sure the project was imported the same way from the root pom.xml file per https://www.jetbrains.com/help/idea/maven-support.html#maven_import_project_start . It should work and look the same.

2. Where do you store this file? Make sure to commit it to Git, and it will be available on all the systems.

3. See https://stackoverflow.com/a/3136255/104891 . Run configurations need to be saved into the project and committed to Git per https://intellij-support.jetbrains.com/hc/en-us/articles/206544839.

4. See https://www.jetbrains.com/help/idea/sharing-your-ide-settings.html . You can also find the list of installed plug-ins in the Plugins directory: https://www.jetbrains.com/help/idea/directories-used-by-the-ide-to-store-settings-caches-plugins-and-logs.html#plugins-directory .

0

I tried to follow your advice but I was completely unable to make the project imported using “Get from VCS” to work.   So I gave up and deleted the project on the laptop.

As my next attempt to migrate the project from PC to laptop I found an old guide indicating that I could Export the project to a zip.   Sadly, in the current version the File/Export only gives me two options:
- Files or Selection to HTML

- Project to Eclipse.

But… I don't really want to export the project to Eclipse.  I want to export it to a zip, move it to the other computer and import it so that it reproduces it EXACTLY as it was in the old computer, and I assume that I'd use File/New/Project from Existing Sources (I don't see an option to do it from the opening screen, so I assume I must create a dummy project first, or create the project… empty then overwrite it with the imported one).

 

In any case, is there a reliable (and hopefully brainless) way to copy a project from one IntelliJ to another on a different computer?

0

> Sadly, in the current version the File/Export only gives me two options:

This is a feature of Android plug-in. It must be installed and enabled. You can also zip or move the project directory using your favorite file manager.

> In any case, is there a reliable (and hopefully brainless) way to copy a project from one IntelliJ to another on a different computer?

Sure, just copy the project directory to a new system.

0

Hmm… I tried it by copying the project directory to the new system's workspace directory, then used “Open” to select the project.  

I am experiencing the same problem as when I imported the project from GitHub:

- I can build (Maven/<project>/Lifecycle/Install) the lowest level module (a library JAR).  It shows in the Maven repository folder correctly.

- But when I try to build a module that depends on it, the build fails saying that it cannot find the JAR in the https://repo.maven.apache.org/maven2 repository.  Of course it can't find it, it is in the LOCAL repository!   

Any idea why it is ignoring the local repository?

0

If you have customized your .m2/settings.xml file, make sure to copy it as well. You may want to copy the entire .m2 directory from the user's home in case it has files that are not available anywhere else.

0

I don't see a settings.xml in .m2 (which if memory serves is the default location for the repository) nor in the new location of my maven repository.

I wonder… is there a Maven component that might be getting confused?  Like… when I execute maven, is it using the one that got downloaded from IntelliJ, or is it using something else?  I most definitely didn't install Maven separately for the new PC, but it is possible I might have done so on the old one as part of some training course.  But since the old one is working fine I doubt that could be the issue.  I assume that Maven built into IntelliJ is the full thing, right?

---

Also in case it is useful, here are some details about the project structure and issues I am seeing (wrote it for another post):

The project was originally based on an series of projects from an Eclipse workspace and converted into the current Project/Module structure over a year ago on another PC.  It is all Maven/Java 17 based.

This project then was copied from that PC to the one having trouble.  The first copy attempt was done by “cloning from version control” (GitHub), when it didn't work I deleted it and used the “copy the Project folder from the old IntelliJ and then Open it” method.  No code at all was changed.  Both methods produced the exact same issues.  The problem clearly 

Project structure:

- Maven project with modules. 

- Main Project = Parent BOM-POM, no code.

- Common library module:  A single module that contains library code built into a JAR that is reused by every Application module.

- Dependencies modules:  Intermediate BOM-POMs, no code, POM has the Main Project as its parent.

- Application modules:  Depending on the type of component each of these modules is a sub-module of a Dependency module and its POM has that Dependency module as its parent.  All of them have the Common library module as a dependency.  Some of these application modules build into library JARs, some into SpringBoot application JARs (with embedded Tomcat), some into webapps or REST WAR components that get deployed onto a Tomcat server.

Symptoms:

1) The most glaring sign of something amiss is the Maven panel of IntelliJ.  

- On the original PC you see ONE project, the main one.  You have to drill down to see the Dependency modules, and drill down further to see the individual Application modules.  At any of these levels you see the lifecycle entry, which will do a Maven build for ALL of its sub-modules.

- On the copied PC the Maven panel shows ALL of the modules at once.  This would be annoying but fine *if* it worked.

2) The most serious problem is the failure for the build to see items in the local repository.  For example:

- When I built the Common library module, it worked fine.  A maven Install built and placed the JAR in the local repository.

- When I tried to build one of the Application modules it failed.  The error indicated that it could not find the Common library module in https://repo.maven.apache.org/maven2 .  Of course it is not there… it is in the local repository, but IntelliJ is refusing to look for it there.

0

Update.  I do have the local repository repointed - which I think is often done in settings.xml - but it is done in Settings/BuildExecutionDeployment/BuildTools/Maven.  Still, that did not triggedr the creation of a settings.xml which is still defaulted to the normal .m2\settings.xml location.

0

I would make it work from the command line Maven first before trying it with the IDE. If it builds without errors in the Terminal, it should also build in IntelliJ IDEA.

0

So, install command line maven outside of IntelliJ?

Because as I said, this whole project works fine in the other PC.

0

Yes, install command line Maven and make sure your project builds with mvn package.

0

Thanks, that seems to have done the trick.  

The only thing that still looks different (there might be more that I have not noticed) is the Maven IntelliJ panel where modules are nested as in Project in the old PC (2023.2.3, build #IU-232.10072.27 from October 11) while in they are fully listed in the new laptop (2023.3.3, build #IU-233.14015.106 from Jan 25).  Maybe it is because of the version difference.

Strangely, the old PC says I have the latest version when I “check for updates”.

In any case… I'll call it “good enough for now”.

0

请先登录再写评论。