Loading src/main/java/com/inteligr8/maven/StandardProjectPropertyResolver.java +28 −23 Original line number Diff line number Diff line Loading @@ -21,9 +21,10 @@ import org.apache.maven.model.Profile; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.logging.AbstractLogEnabled; @Component(role = ProjectPropertyResolver.class) public class StandardProjectPropertyResolver implements ProjectPropertyResolver { @Component(role = ProjectPropertyResolver.class, instantiationStrategy = "per-lookup") public class StandardProjectPropertyResolver extends AbstractLogEnabled implements ProjectPropertyResolver { @Requirement private MavenSession session; Loading Loading @@ -51,34 +52,38 @@ public class StandardProjectPropertyResolver implements ProjectPropertyResolver private Properties findPropertiesObject(String key) { // search the user/cli properties first Properties props = this.session.getUserProperties(); if (props.containsKey(key)) if (props.containsKey(key)) { this.getLogger().debug("Found in session user properties: " + key); return props; } MavenProject ancestor = this.project; while (ancestor != null) { // search the profiles next; in order (FIXME maybe we should go backwards?) for (Profile profile : this.project.getActiveProfiles()) { for (Profile profile : ancestor.getActiveProfiles()) { props = profile.getProperties(); if (props.containsKey(key)) if (props.containsKey(key)) { this.getLogger().debug("Found in project profile properties: " + ancestor.getArtifact() + ": " + profile.getId() + ": " + key); return props; } } // now look at the project props props = this.project.getProperties(); if (props.containsKey(key)) return props; // now recursively look up the parent project props MavenProject ancestor = this.project.getParent(); while (ancestor != null) { props = ancestor.getProperties(); if (props.containsKey(key)) if (props.containsKey(key)) { this.getLogger().debug("Found in project properties: " + ancestor.getArtifact() + ": " + key); return props; } ancestor = ancestor.getParent(); } // search the system properties last (FIXME is this right?) props = this.session.getSystemProperties(); if (props.containsKey(key)) if (props.containsKey(key)) { this.getLogger().debug("Found in system properties: " + key); return props; } return null; } Loading Loading
src/main/java/com/inteligr8/maven/StandardProjectPropertyResolver.java +28 −23 Original line number Diff line number Diff line Loading @@ -21,9 +21,10 @@ import org.apache.maven.model.Profile; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.logging.AbstractLogEnabled; @Component(role = ProjectPropertyResolver.class) public class StandardProjectPropertyResolver implements ProjectPropertyResolver { @Component(role = ProjectPropertyResolver.class, instantiationStrategy = "per-lookup") public class StandardProjectPropertyResolver extends AbstractLogEnabled implements ProjectPropertyResolver { @Requirement private MavenSession session; Loading Loading @@ -51,34 +52,38 @@ public class StandardProjectPropertyResolver implements ProjectPropertyResolver private Properties findPropertiesObject(String key) { // search the user/cli properties first Properties props = this.session.getUserProperties(); if (props.containsKey(key)) if (props.containsKey(key)) { this.getLogger().debug("Found in session user properties: " + key); return props; } MavenProject ancestor = this.project; while (ancestor != null) { // search the profiles next; in order (FIXME maybe we should go backwards?) for (Profile profile : this.project.getActiveProfiles()) { for (Profile profile : ancestor.getActiveProfiles()) { props = profile.getProperties(); if (props.containsKey(key)) if (props.containsKey(key)) { this.getLogger().debug("Found in project profile properties: " + ancestor.getArtifact() + ": " + profile.getId() + ": " + key); return props; } } // now look at the project props props = this.project.getProperties(); if (props.containsKey(key)) return props; // now recursively look up the parent project props MavenProject ancestor = this.project.getParent(); while (ancestor != null) { props = ancestor.getProperties(); if (props.containsKey(key)) if (props.containsKey(key)) { this.getLogger().debug("Found in project properties: " + ancestor.getArtifact() + ": " + key); return props; } ancestor = ancestor.getParent(); } // search the system properties last (FIXME is this right?) props = this.session.getSystemProperties(); if (props.containsKey(key)) if (props.containsKey(key)) { this.getLogger().debug("Found in system properties: " + key); return props; } return null; } Loading