@@ -140,16 +140,6 @@ private void setUpOverrideCompatibilityChanges(
140140 break ;
141141 }
142142 }
143- // This is dead code. foundSemanticVersionLevel is initialized above, and the for-loop
144- // never sets it to null; therefore, it is always non-null.
145- //
146- // if (foundSemanticVersionLevel == null) {
147- // throw new MojoFailureException("Unknown semantic version level '"
148- // + semanticVersionLevel
149- // + "'. Supported values: "
150- // + Joiner.on(',').join(
151- // JApiSemanticVersionLevel.values()));
152- // }
153143 comparatorOptions .addOverrideCompatibilityChange (
154144 new JarArchiveComparatorOptions .OverrideCompatibilityChange (foundChange ,
155145 configChange .isBinaryCompatible (),
@@ -903,22 +893,8 @@ List<JApiCmpArchive> resolveDependencyToFile(final String parameterName,
903893 }
904894 } else {
905895 // Substitute any properties in the path with their values
906- final String systemPath = dependency .getSystemPath ();
907- final StringBuffer newSystemPath = new StringBuffer ();
908- final Pattern pattern = Pattern .compile ("\\ $\\ {([^}]*)}" );
909- final Matcher matcher = pattern .matcher (systemPath );
910- while (matcher .find ()) {
911- final String property = matcher .group (1 );
912- final String propertyResolved = mavenParameters .mavenProject ().getProperties ().getProperty (property );
913- if (propertyResolved != null ) {
914- matcher .appendReplacement (newSystemPath , Matcher .quoteReplacement (propertyResolved ));
915- } else {
916- throw new MojoFailureException ("Could not resolve property '" + property + "'." );
917- }
918- }
919- matcher .appendTail (newSystemPath );
920-
921- final File file = new File (newSystemPath .toString ());
896+ final String systemPath = expandProperties (dependency .getSystemPath ());
897+ final File file = new File (systemPath );
922898 boolean addFile = true ;
923899 if (!file .exists ()) {
924900 if (ignoreMissingArtifact (configurationVersion )) {
@@ -946,6 +922,30 @@ List<JApiCmpArchive> resolveDependencyToFile(final String parameterName,
946922 return jApiCmpArchives ;
947923 }
948924
925+ /**
926+ * Expands any properties found in the given {@code String}.
927+ *
928+ * @param source the source {@code String} to expand
929+ * @return the source {@code String} with all properties expanded
930+ * @throws MojoFailureException if a property can't be resolved
931+ */
932+ private String expandProperties (final String source ) throws MojoFailureException {
933+ final StringBuffer newString = new StringBuffer ();
934+ final Pattern pattern = Pattern .compile ("\\ $\\ {([^}]*)}" );
935+ final Matcher matcher = pattern .matcher (source );
936+ while (matcher .find ()) {
937+ final String property = matcher .group (1 );
938+ final String propertyResolved = mavenParameters .mavenProject ().getProperties ().getProperty (property );
939+ if (propertyResolved != null ) {
940+ matcher .appendReplacement (newString , Matcher .quoteReplacement (propertyResolved ));
941+ } else {
942+ throw new MojoFailureException ("Could not resolve property '" + property + "'." );
943+ }
944+ }
945+ matcher .appendTail (newString );
946+ return newString .toString ();
947+ }
948+
949949 private boolean ignoreMissingArtifact (final ConfigurationVersion configurationVersion ) {
950950 return ignoreNonResolvableArtifacts ()
951951 || ignoreMissingOldVersion (configurationVersion )
0 commit comments