How to perform "reload all Maven projects" (non-incrementally) with the classic UI?

已回答

I recently upgraded to IntelliJ 2024.2.1 which has a new “reload all Maven projects incrementally” feature in the Maven window. Sometimes, I would like to perform a full sync, meaning that I would like to reload all Maven projects in the old-fashioned style, non-incrementally. When I use the new UI, I can still do this using a button on the sync tab in the build tool window. But I prefer the classic UI and I have installed the according plugin for it. In the classic UI, the sync tab of the build tool window does not have this button, and there is also no action for doing a full sync. So I sometimes cannot build my project properly with the classic UI.

So my question is: how can I perform the old-fashioned, non-incremental “reload all Maven projects” with the classic UI?

0

Hello, Christian!

In both Classic and Modern UI Full (Non-incremental) Sync can be performed from the Build Tool Window:

 It can also be assigned a hotkey via the Keymap ("Reload All Maven Projects").

0

Hello Roman Vatagin,

thank you. I was mistaken regarding the missing full sync button on the build tool window. I still think it is cumbersome that the full sync is not available from the Maven tool window. For example, when I open up IDEA, the build tool window icon is not even visible. To make it visible, I have to build my project or perform a Maven sync. The only thing that saves me at that moment is your hint with the keymap.

But for my users, I would like to have the full sync button available in the GUI right when IDEA starts.
Apparently, it is currently not possible to integrate the button into the main toolbar: https://youtrack.jetbrains.com/issue/IDEA-357636/Reload-all-Maven-Projects-Action-will-not-be-shown-in-Main-Toolbar
I also wonder why it is not available as action when you do a “search everywhere”: 

Is it possible to make the build tool window automatically visible right when IDEA has started?
Or is it possible to customize the Maven tool window so that the full sync button is part of it like in older versions?

0

Christian,

Thank you for the update!

I'm afraid, those are the only options to trigger the Full Sync and I don't think it would be possible to adjust the UI to make it immediately available upon Project opening. We are looking into fine-tuning the UI in regards to Full  / Incremental Sync availability, so that may change in future versions of IDEA.

However, Incremental Sync should be providing the same results as a Full one, while being significantly more effective. Would you be able to share more details about your use-case, that always requires a Full Sync on Project open?

0

Hi Roman Vatagin ,

the thing is not so much about requiring a full sync when opening the project, it is just about the ability to do a full sync without any preconditions at all. Currently, the build tool window only shows AFTER having performed a build or an incremental sync, so I have to perform one of these for the full sync to be visible in the GUI at all. This is not very intuitive and not very nice for users who rather like to click in the GUI than memorize hotkeys.

The reason why I would like to use the full sync is that the incremental sync does not work for us - it does not set up the dependencies correctly. We build a huge enterprise Maven application so that it is quite hard to find the reason for this or provide a reproducable test case. I have one little suspicion though: Could it be that the incremental sync mistakenly ignores Maven profiles? We have set up two Maven profiles and activated them in the Maven tool window (see below), but the build result of the incremental sync looks like if the activation of these profiles has been ignored. The full sync works fine though. 

Good to hear that you are planning to fine-tune the UI regarding the full and incremental sync, as the accessibility of the full sync is by far lower compared to the past. So any improvements will be very appreciated.

0

Christian,

Thank you for sharing the details!

I've discovered an issue, where active Profiles are not applied to the Maven Run Configurations, that might be relevant to the problem you're experiencing.

I would appreciate, however, if you could elaborate on your usage scenario: Profiles matter for Maven's Goals and Lifecycles, Sync, on the other hand, is a technical operation that only affects IDEA itself.

 

0

Hi Roman Vatagin,

in our build system, we use Maven profiles in order to determine from where certain dependencies should be picked up. If a certain profile is activated, these dependencies will be picked up from the local IntelliJ modules, otherwise, they will be picked up from the local Maven repository.

So if IntelliJ “forgets” to use the active profiles, the developers will not see the changes they made to the local IntelliJ modules when they run the application locally.

This exactly happens when we perform the new “incremental sync” instead of the “full sync”. So I thought that may be that the incremental sync “forgets” to use the activated profiles. But as the sync is a black box for me, I do not know if the sync needs to care about Maven profiles at all. So it was just a guess what was going wrong, assuming that the Maven profiles must be used during the sync.

What you also probably need to know is how we build our application using IntelliJ. This is done by the following two steps: 

  1. Run an according Maven goal on the project's aggregate POM (with the correct profiles are activated).
  2. Perform a full sync (aka “Reload all Maven projects” non-incrementally)

This has been the only way for us for years to get all dependencies to be set up properly. 
 

0

Christian,

Thank you for sharing the details!

I'm currently trying to reproduce the issue, so I can take it to the developers.

Could you please share a snippet from the pom.xml showing how exactly this is implemented on your end?

0

Hi, I would like to add my voice to the choir, as I have recently run into problems that are similar to those faced by Christian.

Linux OS,  Intellij Ultimate 2024.2.3.

While our enterprise system also uses profiles, I found my problem to be with the versioning of dependencies.

I have just bumped up the version of a side project that our main project is dependent on.

The old version was not in any of our pom files, and mvn dependency:tree showed no trace of it.

But I found that, so long as the old version remained in my .M2, when Reloading All Maven Projects incrementally, the old version would be reloaded into the project. 

Intellij would then build the project with both versions of the dependecy, and inevitably fail when executing new code on old bytecode.

This issue seems resolvable by either removing the old version in my .M2 folder, or using the old non incremental reload.

 

Hope this can be of some assistance to someone.


Best Wishes 

0

J Jorgensen Thank you for reporting this!

Could you please share more details about the exact changes that were made to the pom.xml(s), so we can try and reproduce this issue?

If the issue is reproducible in your environment, could you please check the Dependencies Analyzer and let me know how the conflicting dependencies are shown there?

 

0

The dependency is internal, but in effect the change was:

	<properties>
		...
		<dependency-version>1.23.4</dependecy-version>
		...
	</properties>

to

	<properties>
		...
		<dependency-version>1.23.5</dependecy-version>
		...
	</properties>


Which is not a lot.

But the only other thing I can think of is that both versions of the dependency would have been build locally. And not downloaded through a repository.

0

J Jorgensen Thank you for sharing the details!

We are currently working on a number of improvements for the Incremental Sync, that are expected to become available in the upcoming IDEA 2024.3.

In the meantime you can run the regular Sync

0

请先登录再写评论。