Author: nbelaevski
Date: 2009-11-19 22:13:24 -0500 (Thu, 19 Nov 2009)
New Revision: 15937
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptBuilder.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java
Log:
Fixed CDK execution issues for aggregation environments
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptBuilder.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptBuilder.java 2009-11-20
02:34:09 UTC (rev 15936)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptBuilder.java 2009-11-20
03:13:24 UTC (rev 15937)
@@ -192,14 +192,18 @@
sourceObjects.add(sourceObject);
}
- CompilationTask task = getJavaCompiler().getTask(null, getFileManager(),
listener, getOptions(), null,
- sourceObjects);
+ if (!sourceObjects.isEmpty()) {
+ CompilationTask task = getJavaCompiler().getTask(null, getFileManager(),
listener, getOptions(), null,
+ sourceObjects);
- task.setProcessors(Arrays.asList(processors));
- task.setLocale(locale);
+ task.setProcessors(Arrays.asList(processors));
+ task.setLocale(locale);
- if (!task.call()) {
- throw new AptException("Compilation error: " + messages);
+ if (!task.call()) {
+ throw new AptException("Compilation error: " + messages);
+ }
+ } else {
+ LOG.info("No source objects detected, skipping compilation");
}
}
Modified:
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java
===================================================================
---
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java 2009-11-20
02:34:09 UTC (rev 15936)
+++
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java 2009-11-20
03:13:24 UTC (rev 15937)
@@ -173,6 +173,10 @@
*/
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
+ if ("pom".equals(project.getPackaging())) {
+ getLog().info("Skipping 'pom' packaging project: " +
project.getModel().getId());
+ return;
+ }
// Setup logger.
LoggerFactory.setLogger(new MavenLogger(getLog()));
@@ -319,9 +323,18 @@
// TODO Auto-generated method stub
}
+ private File resolveRelativePath(File file) {
+ File result = file;
+ if (!result.isAbsolute()) {
+ result = new File(project.getBasedir(), result.getPath());
+ }
+
+ return result;
+ }
+
private Iterable<File> findTemplateFiles() throws MojoExecutionException {
if (null == templates) {
- File defaultDirectory = new File(MAIN_TEMPLATES);
+ File defaultDirectory = resolveRelativePath(new File(MAIN_TEMPLATES));
if (defaultDirectory.exists() && defaultDirectory.isDirectory()) {
FileSet fileSet = new FileSet();
@@ -353,7 +366,7 @@
private Iterable<File> findFacesConfigFiles() throws MojoExecutionException {
if (null == facesConfigs) {
- File defaultDirectory = new File(MAIN_CONFIG);
+ File defaultDirectory = resolveRelativePath(new File(MAIN_CONFIG));
if (defaultDirectory.exists() && defaultDirectory.isDirectory()) {
FileSet fileSet = new FileSet();
@@ -423,16 +436,11 @@
for (FileSet fileSet : filesets) {
String[] includes = (String[])
fileSet.getIncludes().toArray(STRINGS_ARRAY);
String[] excludes = (String[])
fileSet.getExcludes().toArray(STRINGS_ARRAY);
- File fileSetDirectory = new File(fileSet.getDirectory());
+ File fileSetDirectory = resolveRelativePath(new
File(fileSet.getDirectory()));
String[] scan = doScan(includes, excludes, fileSetDirectory);
for (String filename : scan) {
- File file = new File(fileSetDirectory, filename);
- if (!file.exists()) {
- file = new File(project.getBasedir(), file.getPath());
- }
-
- files.add(file);
+ files.add(resolveRelativePath(new File(fileSetDirectory, filename)));
}
}
}
Show replies by date