java - How to get maven to timeout earlier while downloading dependencies? -
I am building my project with Apache Maven and a custom repository is configured, but when this repository is configured After killing this very
After downloading it:
It goes a few minutes and downloads it to a central repo
Downloading: 12K Download (Spring -2.5.6. Pom)
I think the timeout wants to be faster than that of it Maven With all new versions of version 2.0.6 or earlier there was no problem, it is very fast from time to time. Before Maven 2.1 in versions, there is no point in configuring the client for timed out
, But you can configure to update at least updates when setting the update policy. This partially addresses the problem.
For example:
& lt; Repository & gt; & Lt; ID & gt; Myrepo & lt; / Id & gt; & Lt; URL & gt; Http: //maven.mycompany.com/m2< / URL & gt; & Lt; Release & gt; & Lt; Enabled & gt; True & lt; / Enable & gt; & Lt; UpdatePolicy & gt; Daily & lt; / UpdatePolicy & gt; & Lt; / Release & gt; & Lt; Snapshot & gt; & Lt; Enabled & gt; False & lt; / Enable & gt; & Lt; UpdatePolicy & gt; Always & lt; / UpdatePolicy & gt; & Lt; / Snapshot & gt; & Lt; / Stores & gt; Valid values are: - Always - always check for new versions of snapshots while Maven starts
- never - new Remote Versions can be updated manually
- Daily (default) - Check on the first part of the day (local time)
- Interval: XXX - Check each XXX minute
Another consideration is the software you are using to host your internal store with a repository manager such as you can manage all your external remote remote connections through the manager and configure timeout for those remote connections Can do May include. Your client will only inquire the repository manager, who should reply with the permission of the timeout.
Update:
If you know that the dependencies are not going to be served by a particular repository, you can separate it into a profile, Not referenced in.
& lt; Profiles & gt; & Lt; Profile & gt; & Lt; ID & gt; Remote & lt; / Id & gt; & Lt; Treasures & gt; & Lt; Stores & gt; & Lt; ID & gt; Central & lt; / Id & gt; & Lt; URL & gt; Http: //repo1.maven.org< / URL & gt; & Lt; Release & gt; & Lt; Enabled & gt; True & lt; / Enable & gt; & Lt; / Release & gt; & Lt; Snapshot & gt; & Lt; Enabled & gt; False & lt; / Enable & gt; & Lt; / Snapshot & gt; & Lt; / Stores & gt; ... & lt; / Repositories & gt; & Lt; / Profile & gt; & Lt; Profile & gt; & Lt; ID & gt; Internal & lt; / Id & gt; & Lt; Treasures & gt; & Lt; Stores & gt; & Lt; ID & gt; Myrepo & lt; / Id & gt; & Lt; URL & gt; Http: //maven.mycompany.com/m2< / URL & gt; & Lt; Release & gt; & Lt; Enabled & gt; True & lt; / Enable & gt; & Lt; / Release & gt; & Lt; Snapshot & gt; & Lt; Enabled & gt; False & lt; / Enable & gt; & Lt; / Snapshot & gt; & Lt; / Stores & gt; ... & lt; / Repositories & gt; & Lt; / Profile & gt; & Lt; / Profile & gt;
With the above configuration, the MVAn package-love will not be connected to the internal storage, so timeout will not be a factor.
You can avoid specifying profiles on each build by adding some additional configurations to your settings:
& lt; Settings & gt; ... & lt; Active Profile & gt; & Lt; ActiveProfile & gt; Internal & lt; / ActiveProfile & gt; & Lt; ActiveProfile & gt; Remote & lt; / ActiveProfile & gt; & Lt; / ActiveProfiles & gt; ... & lt; / Settings & gt; For Maven 2.1 you can set a timeout by adding configuration to a server in Maven settings, for example: & lt; Server & gt; & Lt; ID & gt; Myrepo & lt; / Id & gt; & Lt; Configuration & gt; & Lt; Timeout & gt; 5000 & lt; / Timeout & gt; & Lt ;! - 5 seconds - & gt; & Lt; / Configuration & gt; & Lt; / Server & gt;
Comments
Post a Comment