diff --git a/src/it/it-property-updates-report-001/pom.xml b/src/it/it-property-updates-report-001/pom.xml index 5fb0beb85..59a117f3c 100644 --- a/src/it/it-property-updates-report-001/pom.xml +++ b/src/it/it-property-updates-report-001/pom.xml @@ -55,25 +55,15 @@ maven-site-plugin - @sitePluginVersion@ - - - maven-project-info-reports-plugin - 2.1 + @maven-site-plugin.version@ + true - - maven-project-info-reports-plugin - 2.1 - - - - @project.groupId@ @project.artifactId@ diff --git a/src/it/it-property-updates-report-002-slow/invoker.properties b/src/it/it-property-updates-report-002-slow/invoker.properties new file mode 100644 index 000000000..b0549c118 --- /dev/null +++ b/src/it/it-property-updates-report-002-slow/invoker.properties @@ -0,0 +1,2 @@ +invoker.goals=site +invoker.timeoutInSeconds=30 diff --git a/src/it/it-property-updates-report-002-slow/maven-version-rules.xml b/src/it/it-property-updates-report-002-slow/maven-version-rules.xml new file mode 100644 index 000000000..2178a2437 --- /dev/null +++ b/src/it/it-property-updates-report-002-slow/maven-version-rules.xml @@ -0,0 +1,117 @@ + + + + + 200[34].* + + + + + .*[.-](rc|pr)\d+ + + + + + 2\.9\.\d+ + .*[.-](rc|pr)\d+ + + + + + .*[.-](rc|pr)\d+ + + + + + .*-RC\d+ + .*-EA\d* + .*-BETA-\d* + + + + + .*\.(Alpha|Beta|CR)\d+ + + + + + .*-alpha\d+ + + + + + .*-(alpha|beta|rc)-\d+ + + + + + .*\.(Alpha|Beta|CR)\d+ + + + + + .*-CR\d+ + + + + + 1.11.1 + 1.11.1-PUBLISHED-BY-MISTAKE + + + + + .*-(beta-|RC)\d* + + + + + .*\.jre[67] + + + + + .*-alpha\d+ + .*-beta\d+ + + + + + .*-atlassian-.* + + + + + .*-beta(\.\d+)? + .*-RC\.\d+ + + + + + .*\.(ALPHA|BETA)\d+ + + + + + .*RC\d+ + .*-beta\.\d+ + + + + + .*-b\d+\.\d+ + + + + + .*-b[\d.]+ + + + + + .*-beta-\d+ + .*-rc-\d+ + + + + diff --git a/src/it/it-property-updates-report-002-slow/pom.xml b/src/it/it-property-updates-report-002-slow/pom.xml new file mode 100644 index 000000000..2db31ed03 --- /dev/null +++ b/src/it/it-property-updates-report-002-slow/pom.xml @@ -0,0 +1,183 @@ + + 4.0.0 + localhost + it-property-updates-report-002-slow + 1.0 + pom + property-updates-report + Validate performance of property-updates-report + + + 3.2.17.RELEASE + 4.3.2.Final + 1.7.10 + 2.2.11 + 0.11.1 + 3.17 + 4.5.2 + 2.6.7.3 + 2.4.3 + 42.2.6 + 2.0.0 + + + + + + org.slf4j + slf4j-api + ${slf4j.version} + + + org.slf4j + slf4j-log4j12 + ${slf4j.version} + + + org.slf4j + slf4j-simple + ${slf4j.version} + + + org.slf4j + jcl-over-slf4j + ${slf4j.version} + + + org.slf4j + jul-to-slf4j + ${slf4j.version} + + + + org.springframework + spring-framework-bom + ${spring.version} + pom + import + + + + org.hibernate + hibernate-validator + ${hibernate-validator.version} + + + + org.postgresql + postgresql + ${postgresql-client.version} + + + + org.mariadb.jdbc + mariadb-java-client + ${mariadb-client.version} + + + + org.apache.httpcomponents + httpclient + ${httpclient.version} + + + org.apache.httpcomponents + fluent-hc + ${httpclient.version} + + + org.apache.httpcomponents + httpclient-cache + ${httpclient.version} + + + org.apache.httpcomponents + httpmime + ${httpclient.version} + + + + com.fasterxml.jackson + jackson-bom + ${jackson.version} + pom + import + + + + org.apache.poi + poi-ooxml + ${poi.version} + + + org.apache.poi + poi-ooxml-schemas + ${poi.version} + + + stax + stax-api + + + + + + org.glassfish.jaxb + jaxb-bom + ${jaxb.version} + pom + import + + + + org.jvnet.jaxb2_commons + jaxb2-basics-runtime + ${jaxb2-basics.version} + + + org.jvnet.jaxb2_commons + jaxb2-basics-testing + ${jaxb2-basics.version} + + + + org.codehaus.groovy + groovy-all + ${groovy.version} + + + + + + + + + maven-site-plugin + @maven-site-plugin.version@ + + + + + + + true + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + file:${project.basedir}/maven-version-rules.xml + + + + + property-updates-report + + + + + + + diff --git a/src/main/java/org/codehaus/mojo/versions/api/DefaultVersionsHelper.java b/src/main/java/org/codehaus/mojo/versions/api/DefaultVersionsHelper.java index 19c71253c..91b4fb7fc 100644 --- a/src/main/java/org/codehaus/mojo/versions/api/DefaultVersionsHelper.java +++ b/src/main/java/org/codehaus/mojo/versions/api/DefaultVersionsHelper.java @@ -164,6 +164,14 @@ public class DefaultVersionsHelper private final MojoExecution mojoExecution; + /** + * A cache mapping artifacts to their best fitting rule, since looking up + * this information can be quite costly. + * + * @since 2.12 + */ + private final Map artifactBestFitRule = new HashMap<>(); + /** * Constructs a new {@link DefaultVersionsHelper}. * @@ -522,6 +530,11 @@ public VersionComparator getVersionComparator( String groupId, String artifactId */ protected Rule getBestFitRule( String groupId, String artifactId ) { + String groupArtifactId = groupId + ':' + artifactId; + if (artifactBestFitRule.containsKey( groupArtifactId )) { + return artifactBestFitRule.get( groupArtifactId ); + } + Rule bestFit = null; final List rules = ruleSet.getRules(); int bestGroupIdScore = Integer.MAX_VALUE; @@ -571,6 +584,8 @@ protected Rule getBestFitRule( String groupId, String artifactId ) } bestFit = rule; } + + artifactBestFitRule.put( groupArtifactId, bestFit ); return bestFit; }