Maven2 plugin fails to detect that schema was changed when generating om, etc
-----------------------------------------------------------------------------

                 Key: TORQUE-118
                 URL: https://issues.apache.org/jira/browse/TORQUE-118
             Project: Torque
          Issue Type: Bug
          Components: Maven 2 Plugin
    Affects Versions: 3.3
         Environment: OS: Linux 2.6.24.4-64.fc8
JDK: jdk1.6.0_07
Maven: apache-maven-2.0.9
            Reporter: Mitri Hanania
            Priority: Minor


Using the Maven2 plugin, generate the OM classes from a schema file. Then make 
a change to the schema file and try to re-generate the OM classes. The Maven2 
plugin will state that the schema has not changed with respect to the report 
file.

After debugging, it seems that the method schemaChanged() in class 
org.apache.torque.mojo.DataModelTaskMojo attempts to compare the last modified 
dates between the schema file and the report file. It uses the classes FileSet 
and DirectoryScanner to obtain a list of schema files to compare against the 
report file. The method DirectoryScanner.getIncludedFiles() is called to return 
a list of schema files in the directory specified by the "schemaDir" property. 
According to the javadocs, DirectoryScanner.getIncludedFiles() returns a list 
of file names relative to the "base" directory. However, the file names are 
being used as if they are absolute file names when trying to retrieve the last 
modified time. Hence, always resulting in a last modified time of 0, which 
causes the schema file to alway fail when comparing to see if the schema file 
has a last modified time greater than the report file.

A work around that I have been using is to always delete the report files when 
a change is made to the schema file.

A proposed fix is to create the schema java.io.File object using the 
"schemaDir" property and the relative file name:

for (int i = 0; i < fileNames.length; ++i)
{
   File file = new File(schemaDir, fileNames[i]);
   if (file.lastModified() > report.lastModified())
   {
     schemaChanged = true;
     break;
   }
}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply via email to