JaroslavTulach commented on a change in pull request #502: #270552: AbstractProjectClassPathImpl subtypes generally need to process Artifact.file to handle timestamped snapshots properly URL: https://github.com/apache/incubator-netbeans/pull/502#discussion_r181958801
########## File path: maven/src/org/netbeans/modules/maven/classpath/AbstractProjectClassPathImpl.java ########## @@ -206,4 +211,33 @@ public void removePropertyChangeListener(PropertyChangeListener propertyChangeLi return project.hashCode() ^ getClass().hashCode(); } + /** + * Like {@link Artifact#getFile} but when a timestamped snapshot is locally downloaded, uses that instead. + */ + protected static File getFile(Artifact art) { + File f = art.getFile(); + if (f != null) { + if (art.isSnapshot() && !art.getVersion().equals(art.getBaseVersion())) { + String name = f.getName(); + int dot = name.lastIndexOf(/* DefaultRepositoryLayout.GROUP_SEPARATOR */'.'); + if (dot > 0 && name.substring(0, dot).endsWith(art.getBaseVersion())) { + File f2 = new File(f.getParentFile(), name.substring(0, dot - art.getBaseVersion().length()) + art.getVersion() + name.substring(dot)); + if (f2.isFile()) { Review comment: An illustrative test for this behavior might be beneficial for future maintenance. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org For additional commands, e-mail: notifications-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists