Closed gevegab closed 5 years ago
Thanks for the report. Could you please transform the attached project to an integration test under https://github.com/mojohaus/license-maven-plugin/tree/master/src/it ?
Hello,
I have created the integration test.
But I had some problems checking out the project, because I develop on Windows and the tests (both unit and integration) failed.
So I decided to fork the project to be sure not to introduce errors on your code base. I will create a cross-fork pull request for you to integrate.
Because of the problems, I have not tried a full build of the project, but I have tested using this command
mvn clean install -DskipTests -DskipITs -Prun-one-it -DitName=ISSUE-135
The windows CI finally started working and I was able to fix the hottest issues. So if you rebase on top of current master, you should basically be able to build on windows. These two integration tests are known to fail: https://github.com/mojohaus/license-maven-plugin/issues/205 and https://github.com/mojohaus/license-maven-plugin/issues/204 where https://github.com/mojohaus/license-maven-plugin/issues/205 could be related to the current issue. Any help here or there would be appreciated, because I neither have Windows nor have any interests in the area of file header mojos.
Ok. I have rebased my branch on the current master and I am able to build on windows.
This issue actually happens on both windows and linux, I will propose you a fix next week.
I also identified the problems with issues #204 and #205 on windows, I commented there and will propose you a fix next week
Hello
I have a java file that has a "package" and "import" on the same line, something like this:
package org.example.test; import java.io.File;
When the file is processed by the "update-file-header" goal, the content after the package declaration (the import) is wrongly truncated, and I obtain something like this (that doesn't compile any longer):
This is a problem to me because the java file is not hand-written, it is generated by a tool that doesn't allow me to control the generated format .. so I can not really workaround the problem
I have pinpointed the problem to this code on class JavaFileHeaderTransformer,
On windows, the line
prolog += getLineSeparator();
adds two characters (CR+LF) to the prolog, so when it later doescontent = content.substring( prolog.length() );
one character is lost from the original content after the "package" declaration.I attach a project with a single java file that shows the problem (the source directory contains the wrongly truncated java file and the original file before header insertion ) test.license.header.zip
Thank you