I found an unfamiliar file .idea/jarRepositories.xml
, when I updated Android Studio 3.5.3
to 4.0.1
on Mac. The content is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="Google" />
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
</component>
</project>
There is already a question on it, and VonC answered that it can be added to .gitignore
.
I was wondering if I should add it in .gitignore
and shouldn't commit it to git. How can I decide to add it to .gitignore
?
JetBrains.gitignore
The popular repository gitignore of github has Android.gitignore
, but it has no .idea/jarRepositories.xml
at the time of writing this question.
On the other hand, Global/JetBrains.gitignore
has the following comments.
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
As you can see, it has .idea/jarRepositories.xml
and the line is commented out. It also has the following notes:
Gradle and Maven with auto-import
When using Gradle or Maven with auto-import, you should exclude module files, since they will be recreated, and may cause churn. Uncomment if using auto-import.
In Android Studio 4.0.x
, is it possible to use Gradle without auto-import?
Remote Jar Repositories
In the above Global/JetBrains.gitignore
, the line # .idea/jarRepositories.xml
has been added by davidkron's pull request, and he commented as follows:
Since IntelliJ 2019.3 this file appeared automatically in our git changes. It seems these are just cached information about remote repositories that are defined in Maven/Gradle.
Reasons for making this change:
In a Maven/Gradle build, automatically generated files should should not be commited.
Links to documentation supporting these rule changes:
I haven't found a documentation or article about this file, but I'm basing my assumption on the following steps:
- in IntelliJ the "Remote Jar Repositories" can be managed in the Settings menu
- I deleted every entry in the list -> file disappeared
- I re-imported the Maven/Gradle project again
- the file appeared again with the same entries present as before
As his comment, Android Studio 4.0.1
has Remote Jar Repositories
settings, as you can see in the following screen shot.
I checked the release notes of Android Studio 4.0.0
, and found a section as follows:
IntelliJ IDEA 2019.3.3
The core Android Studio IDE has been updated with improvements from IntelliJ IDEA through the 2019.3.3 release.
To learn more about the improvements from other IntelliJ versions that are included cumulatively with version 2019.3.3, see the following pages:
- IntelliJ IDEA 2019.3
- IntelliJ IDEA 2019.3.3
I'm not sure but was wondering if I should add .idea/jarRepositories.xml
in .gitignore
and shouldn't commit it to git. How can I decide to add it or not? I really appreciate it if someone could clarify the criteria.
Update:
In the source code of Android Studio 4.0.0
, I found source files, which define the file name jarRepositories.xml
:
JpsRemoteRepositoriesConfigurationSerializer.java
public JpsRemoteRepositoriesConfigurationSerializer() {
super("jarRepositories.xml", "RemoteRepositoriesConfiguration");
}
RemoteRepositoriesConfiguration.java
@State(name = "RemoteRepositoriesConfiguration", storages = @Storage("jarRepositories.xml"))
public class RemoteRepositoriesConfiguration implements PersistentStateComponent<RemoteRepositoriesConfiguration.State> {
// ...
}
I also found their origins in the repository of JetBrain's IntelliJ IDEA Community Edition.
Jps
stands for JetBrains Project System, according to a document:
The project model in External Build process is provided by JPS (JetBrains Project System).
JPS's previous repository describes itself as:
Gant based build framework + dsl, with declarative project structure definition and automatic IntelliJ IDEA projects build