Issue
I'm developing a Java-based application and using Maven to manage its packages with Visual Studio Code.
While coding, I have noticed that my git detects some slf4j files were automatically updated even though I did nothing about my code. The updated files are not actually libraries, but only Javadoc, sources, and some text files.
I don't want them to update automatically but want to manually update them if needed. What is the cause of this behavior and how can I suppress it?
I know I can stop Maven from updating dependent libraries when building my codes by attaching -o
to a command, is there any similar ways?
Solution
I've modified the configuration file settings.xml
to include the following section and now Maven no longer updates its local repository.
<profiles>
<profile>
<repositories>
<repository>
<id>repo1</id>
<url>https://repo.maven.apache.org/maven2/</url>
<releases>
<updatePolicy>Never</updatePolicy>
</releases>
<snapshots>
<updatePolicy>Never</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
repository
section is needed for all repos that are currently used. Even with this setting, Maven can download libraries if they don't exist in the local repository when building a package.
Answered By - Daigo
Answer Checked By - Timothy Miller (JavaFixing Admin)