revelc / formatter-maven-plugin

Formatter Maven Plugin
https://code.revelc.net/formatter-maven-plugin
Apache License 2.0
291 stars 91 forks source link

build failure on missing src/main/java or src/test/java #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Situation as described in
http://maven-java-formatter-plugin.googlecode.com/svn/site/0.3/examples.html#Mul
timodule_Configuration

What is the expected output? What do you see instead?
I expect non-existing source and test paths to not ignored instead of a build 
failure.

mvn install on the parent fails because there are no src/main/java and 
src/test/java in the parent project. Also fails when the src/test/java is 
missing.

What version of the product are you using? On what operating system?
                <groupId>com.googlecode.maven-java-formatter-plugin</groupId>
                <artifactId>maven-java-formatter-plugin</artifactId>
                <version>0.3</version>
On win XP

Please provide any additional information below.
Part from the build log:
[INFO] [java-formatter:format {execution: default}]
[WARNING] File encoding has not been set, using platform encoding (Cp1252) to fo
rmat source files, i.e. build is platform dependent!
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] basedir D:\java\Performance\src\main\java does not exist
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.IllegalStateException: basedir D:\java\Performance\src\main\java does
not exist
        at org.codehaus.plexus.util.DirectoryScanner.scan(DirectoryScanner.java:
290)
        at org.codehaus.plexus.components.io.resources.PlexusIoFileResourceColle
ction.getResources(PlexusIoFileResourceCollection.java:173)
        at com.relativitas.maven.plugins.formatter.FormatterMojo.addCollectionFi
les(FormatterMojo.java:329)
        at com.relativitas.maven.plugins.formatter.FormatterMojo.execute(Formatt
erMojo.java:270)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
nManager.java:453)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:559)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLi
fecycle(DefaultLifecycleExecutor.java:500)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
ltLifecycleExecutor.java:479)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
dleFailures(DefaultLifecycleExecutor.java:331)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
ts(DefaultLifecycleExecutor.java:292)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
fecycleExecutor.java:142)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:301)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)

        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

Original issue reported on code.google.com by jeroen.d...@gmail.com on 3 Mar 2011 at 7:38

GoogleCodeExporter commented 9 years ago

Original comment by matt.blanchette@gmail.com on 3 Mar 2011 at 8:38

GoogleCodeExporter commented 9 years ago
Verified in testing
Also fails for the case when the modules are missing either the source and test 
source directories (src/main/java and src/test/java by default)
Maven site example for multimodule currently will not work

Works successfully in multi-module setup only when the format execution goal is 
placed in the poms of modules that contain both the source and test source 
directories, still allowing the plugin version and configuration to be 
specified in the parent pom.

Original comment by matt.blanchette@gmail.com on 3 Mar 2011 at 8:58

GoogleCodeExporter commented 9 years ago

Original comment by matt.blanchette@gmail.com on 3 Mar 2011 at 8:58

GoogleCodeExporter commented 9 years ago
Fix committed in r112

Handles missing main source or test source directories (to avoid 
IllegalStateException thrown by DirectoryScanner)
Added to not continue with no files for format, avoiding read/write cache file 
and log messages when not necessary

Original comment by matt.blanchette@gmail.com on 3 Mar 2011 at 9:30

GoogleCodeExporter commented 9 years ago
Merged fix to trunk in r116

Available in version 0.3.1 tagged release

Original comment by matt.blanchette@gmail.com on 3 Mar 2011 at 10:30