Only check missed dependencies on plugin projects.

This commit is contained in:
robin 2012-04-26 10:57:21 +08:00
parent 4b6c98e26e
commit be94392ba5
7 changed files with 21 additions and 9 deletions

View File

@ -5,7 +5,7 @@
<groupId>$groupId</groupId> <groupId>$groupId</groupId>
#end #end
<artifactId>$artifactId</artifactId> <artifactId>$artifactId</artifactId>
#if ($version != "1.0.0") #if ($version != "1.0.1")
<version>$version</version> <version>$version</version>
#end #end
<parent> <parent>

View File

@ -5,7 +5,7 @@
<groupId>${groupId}</groupId> <groupId>${groupId}</groupId>
#end #end
<artifactId>${artifactId}</artifactId> <artifactId>${artifactId}</artifactId>
#if (${version} != "1.0.0") #if (${version} != "1.0.1")
<version>${version}</version> <version>${version}</version>
#end #end
<parent> <parent>

View File

@ -5,7 +5,7 @@
<groupId>\${groupId}</groupId> <groupId>\${groupId}</groupId>
#end #end
<artifactId>\${artifactId}</artifactId> <artifactId>\${artifactId}</artifactId>
#if (\${version} != "1.0.0") #if (\${version} != "1.0.1")
<version>\${version}</version> <version>\${version}</version>
#end #end
<parent> <parent>

View File

@ -143,7 +143,7 @@
<executables>bin/*.sh, bin/wrapper-*</executables> <executables>bin/*.sh, bin/wrapper-*</executables>
<bootstrapClass>com.pmease.commons.bootstrap.Bootstrap</bootstrapClass> <bootstrapClass>com.pmease.commons.bootstrap.Bootstrap</bootstrapClass>
<moduleClass>${package}.PluginModule</moduleClass> <moduleClass>${package}.PluginModule</moduleClass>
<aggregation>false</aggregation> <aggregation>true</aggregation>
</properties> </properties>
</project> </project>

View File

@ -156,7 +156,7 @@
<plugin> <plugin>
<groupId>com.pmease</groupId> <groupId>com.pmease</groupId>
<artifactId>plugin.maven</artifactId> <artifactId>plugin.maven</artifactId>
<version>1.0.0</version> <version>1.0.1</version>
<executions> <executions>
<execution> <execution>
<id>check-project-dependencies</id> <id>check-project-dependencies</id>

View File

@ -4,7 +4,7 @@
<groupId>com.pmease</groupId> <groupId>com.pmease</groupId>
<artifactId>plugin.maven</artifactId> <artifactId>plugin.maven</artifactId>
<version>1.0.0</version> <version>1.0.1</version>
<packaging>maven-plugin</packaging> <packaging>maven-plugin</packaging>
<prerequisites> <prerequisites>

View File

@ -74,9 +74,21 @@ public class CheckProjectDependenciesMojo extends AbstractMojo {
dependencyKeys.add(artifact.getGroupId() + "." + artifact.getArtifactId()); dependencyKeys.add(artifact.getGroupId() + "." + artifact.getArtifactId());
} }
for (Map.Entry<String, String> entry : projectVersions.entrySet()) { Set<String> pluginKeys = new HashSet<String>();
if (!dependencyKeys.contains(entry.getKey())) for (File projectDir : workspaceDir.listFiles()) {
errors.add("Missed dependency to project '" + entry.getKey() + "'."); if (!projectDir.equals(project.getBasedir())) {
File propsFile = new File(projectDir, "target/classes/"
+ PluginConstants.PLUGIN_PROPERTY_FILE);
if (propsFile.exists()) {
Properties props = PluginUtils.loadProperties(propsFile);
pluginKeys.add(props.getProperty("id"));
}
}
}
for (String pluginKey: pluginKeys) {
if (!dependencyKeys.contains(pluginKey))
errors.add("Missed dependency to project '" + pluginKey + "'.");
} }
Map<String, Set<String>> artifactVersions = new HashMap<String, Set<String>>(); Map<String, Set<String>> artifactVersions = new HashMap<String, Set<String>>();