Hi,

I noticed on new projects I started with Maven that, when there is no
${basedir}/LICENSE.txt, Checkstyle fails, throwing a
"Unable to create a checker" error, causing the whole "maven:site" build
to fail with a very limited information of why it
failed.

I tried several ways to come around this, setting headerFile to "" if
the file didn't exist, creating another target depending on
whether the file exists (very very bad solution, IMO), etc, which all
failed.

What I did is include a dummy LICENSE.txt in ${maven.home}/plugins/core/
(only 2 empty lines at the top), and tell Checkstyle
to use that file if the file is missing.

The LICENSE.txt file is to be copied to src/templates/build/plugins/core/ .

Here are the patches to do that.

St�phane

Index: src/templates/build/plugins/core/Control.vm
===================================================================
RCS file: 
/home/cvspublic/jakarta-turbine-maven/src/templates/build/plugins/core/Control.vm,v
retrieving revision 1.1
diff -u -r1.1 Control.vm
--- src/templates/build/plugins/core/Control.vm 15 May 2002 19:51:11 -0000      1.1
+++ src/templates/build/plugins/core/Control.vm 26 May 2002 20:29:35 -0000
@@ -7,6 +7,7 @@
 ## -------------------------------------------------------
 $buildElements.add("plugins/$plugin/build.xml")
 $buildElements.add("plugins/$plugin/default.properties")
+$buildElements.add("plugins/$plugin/LICENSE.txt")
 
 ## -------------------------------------------------------
 ## Make the list of delegators

Index: src/templates/build/plugins/core/build.xml
===================================================================
RCS file: 
/home/cvspublic/jakarta-turbine-maven/src/templates/build/plugins/core/build.xml,v
retrieving revision 1.2
diff -u -r1.2 build.xml
--- src/templates/build/plugins/core/build.xml  24 May 2002 15:41:28 -0000      1.2
+++ src/templates/build/plugins/core/build.xml  26 May 2002 20:29:57 -0000
@@ -351,6 +351,12 @@
       </classpath>
     </taskdef>
 
+    <condition property="maven.checkstyle.header.file" 
+value="${maven.home}/plugins/core/LICENSE.txt">
+      <not>
+        <available file="${maven.checkstyle.header.file}"/>
+      </not>
+    </condition>
+
     <checkstyle
       lcurlyType="${maven.checkstyle.lcurly.type}"
       lcurlyMethod="${maven.checkstyle.lcurly.method}"





--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to