Searching Nexus never reveals latest artifact versions
Our shop uses Nexus to proxy for Maven Central and several other repositories. From time to time we use it to search for artifacts to see if what other versions might be available. However it rarely, if ever, shows these newer versions of things. This has thrown off developers many times who expected to see them in Nexus if they existed at all.
A recent example is the 1.5.0.RELEASE version开发者_如何学C of org.springframework.flex:spring-flex. If wasn't in our Nexus index anywhere, but we could find it by Googling Maven Central. The Maven versions plugin was also able to find it.
How can we configure our Nexus to refresh its indices so we can trust it in the future?
I can see org.springframework.flex:spring-flex:1.5.0.RELEASE when I search for it, and I have a pretty plain-vanilla Nexus installation. Check in the repository's configuration for "Metadata Max Age". First log in, then click "Repositories" in the left panel, select the repo you're interested in ("Maven Central", right?), and click the "Configuration" tab at the bottom. "Metadata Max Age" is under the "Expiration Settings" section. If this is set to "-1", that means repo metadata will never be updated. Mine is set to 1440 minutes (24 hours), and I've never had a problem with failing to find new artifacts. The problem you're describing is exactly what this setting is supposed to prevent.
If that seems to not be working, you could try setting a scheduled task to update your indexes. Logged in as an administrator, select "Administration" in the left panel, and go to "Scheduled Tasks". Add a task with "Task Type" = "Download Indexes", and select the repository or repo group you want it to apply to (or "All Repositories"). Make sure you set a "Recurrence" on it. Do this for each repository/group that needs to be updated.
Have you tried to set up a scheduled task to download the remote indexes?
Nexus supports scheduled tasks to do all sorts of maintenance and it is good practice to include the index download in it. Check the book out in general it has lots of good information.
精彩评论