Hi James,

I will have a look at it - I need to cross-check since this is actually a JavaNCSS bug.

There are a few workaround to skip the JavaNCSS report depending on your setup, the best is probably using "maven.javancss.enable=false" in the build.properties for your affected project. In this case no JavaNCSS report will registered and therefore generated. Originally this flag was used to skip reports for generated code but it might solve your problem nicely.

Thanks

Siegfried Goeschl


James Richardson wrote:

I've noticed that the Java ncss plugin will hang indefinitely if there are
no java source files to count.

This can happen, if for example, your subproject contains only
auto-generated code (e.g. castor).

A src/java directory is required to convince maven that there is any thing
at all to compile (thus the check for sourcesPresent is not sufficient).

It would be a good thing to check that there were some java source files
to count before launching the ncss plugin.

I did try to make this change to the plugin, but I'm afraid I've never
written any jelly scripts really.

My attempt is included below, if its any use to anybody (it doesn't quite
work).

Best Regards,

James


<goal name="javancss:do-xml" description="Generate source code metrics with JavaNCSS">

   <mkdir dir="${maven.javancss.docs.dest}"/>
   <mkdir dir="${maven.javancss.build.dir}"/>

   <ant:echo>Scanning ${pom.build.sourceDirectory}</ant:echo>

   <ant:fileScanner var="ncssSourceFiles">
     <ant:fileset dir="${pom.build.sourceDirectory}">
        <ant:include name="**/*.java" />
     </ant:fileset>
   </ant:fileScanner>

   <j:if test="${ncssSourceFiles.hasFiles() == true}">

     <echo>Generating JavaNCSS report</echo>

     <java classname="javancss.Main" fork="yes">
        <classpath>
          <fileset dir="${plugin.dir}/plugin-resources/jars">
            <include name="**/*.jar"/>
          </fileset>
        </classpath>
        <pathelement path="${plugin.getDependencyPath('xerces')}"/>
        <j:if test="${enablePackage.equalsIgnoreCase('true')}">
          <arg value="-package"/>
        </j:if>
        <j:if test="${enableObject.equalsIgnoreCase('true')}">
          <arg value="-object"/>
        </j:if>
        <j:if test="${enableFunctions.equalsIgnoreCase('true')}">
          <arg value="-function"/>
        </j:if>
        <arg value="-recursive"/>
        <arg value="-xml"/>
        <arg value="-out"/>
        <arg value="${maven.javancss.build.dir}/javancss-raw-report.xml"/>
        <arg value="${pom.build.sourceDirectory}"/>
     </java>

<doc:jsl
input="${maven.javancss.build.dir}/javancss-raw-report.xml"
output="javancss-report.xml"
stylesheet="${plugin.resources}/${maven.javancss.jsl}"
outputMode="xml"
prettyPrint="true"
/>
</j:if>


<j:if test="${ncssSourceFiles.hasFiles() == false}">
<ant:echo>Warning: JavaNCSS can't be run when there are no source
files</ant:echo>
</j:if>


 </goal>

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






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



Reply via email to