You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by "Allison, Timothy B." <ta...@mitre.org> on 2016/03/21 17:08:53 UTC
forbiddenapi's testCheck for Tika 2.0?
All,
In sketching out the restructuring of test resources (test-documents and general test code), I'm now getting an error from forbidden api's testCheck. The current proposal was to have a project called "tika-test-resources" with no code in main and no code in test, just the "test-documents" folder and other test resources.
The module tika-core now depends on tika-test-resources.
When I tried this change, I saw that forbidden api's skipped "main" in tika-test-resources because there were no class files. However, it didn't skip "test," and it through a ClassNotFoundException for CompositeParser...any idea what's going on?
[INFO] --- forbiddenapis:2.0:check (default) @ tika-test-resources ---
[INFO] Scanning for classes to check...
[WARNING] No classes found in 'C:\Users\tallison\Idea Projects\tika-asf-git-2_x\tika-test-resources\target\classes' (includes=[**/*.class], excludes=null), forbiddenapis check skipped.
[INFO]
[INFO] --- forbiddenapis:2.0:testCheck (default) @ tika-test-resources ---
[INFO] Scanning for classes to check...
[INFO] Reading bundled API signatures: jdk-unsafe-1.7
[INFO] Reading bundled API signatures: jdk-deprecated-1.7
[INFO] Reading bundled API signatures: commons-io-unsafe-2.4
[WARNING] Class 'org.apache.commons.io.CopyUtils' not found on classpath while parsing signature: org.apache.commons.io.CopyUtils#copy(byte[],java.io.Writer) [signature ignored]
...
[INFO] Loading classes to check...
[INFO] Scanning classes for violations...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Apache Tika parent ................................ SUCCESS [4.506s]
[INFO] Apache Tika Test Resources ........................ FAILURE [19.216s]
[INFO] Apache Tika core .................................. SKIPPED
....
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 25.296s
[INFO] Finished at: Mon Mar 21 12:05:00 EDT 2016
[INFO] Final Memory: 23M/437M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal de.thetaphi:forbiddenapis:2.0:testCheck (default) on project tika-test-resources: Check for forbidden API calls failed: java.lang.ClassNotFoundException: org.apache.tika.parser.CompositeParser -> [Help 1]
[ERROR]
RE: forbiddenapi's testCheck for Tika 2.0?
Posted by "Allison, Timothy B." <ta...@mitre.org>.
Perfect. Now works. Thank you, Uwe!
-----Original Message-----
From: Uwe Schindler [mailto:uwe@thetaphi.de]
Sent: Tuesday, March 22, 2016 3:24 AM
To: dev@tika.apache.org
Subject: RE: forbiddenapi's testCheck for Tika 2.0?
Hi,
To disable: See the "bundle" plugin, put something like that into the pom.xml (copied from there):
<!-- The Tika Bundle has no java code of its own, so no need to do -->
<!-- any forbidden API checking against it (it gets confused...) -->
<plugin>
<groupId>de.thetaphi</groupId>
<artifactId>forbiddenapis</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
What may happen here is (I am not 100% sure because I cannot look into it - it is on your computer only): In the resources you have some *.class file for testing ASM parser. Of course, forbidden-apis picks that from the output folder "target/test-classes", because the test resources are copied there. In contrast to normal modules, the dependencies to parse this "demo" class file are missing -> failure. In my local checkout the test class resource is "AutoDetectParser.class", this would create the failure in isolation - of course.
Uwe
-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de
> -----Original Message-----
> From: Allison, Timothy B. [mailto:tallison@mitre.org]
> Sent: Tuesday, March 22, 2016 4:19 AM
> To: dev@tika.apache.org
> Subject: RE: forbiddenapi's testCheck for Tika 2.0?
>
> Thank you, Uwe.
>
> I did try "mvn clean," and that didn't work.
>
> Is there an easy way to disable it for just one module? Apologies for
> the likely dunceness of this question...
>
> -----Original Message-----
> From: Uwe Schindler [mailto:uwe@thetaphi.de]
> Sent: Monday, March 21, 2016 12:18 PM
> To: dev@tika.apache.org
> Subject: RE: forbiddenapi's testCheck for Tika 2.0?
>
> Hi,
>
> Theoretically it should also skip test files, but it will only do this
> if the folder does not exist in "output" dir (below "target/"). Maybe
> you missed to run "mvn clean" before testing?
>
> Otherwise you can also disable the plugin for the test-resources module.
>
> Uwe
>
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: uwe@thetaphi.de
>
>
> > -----Original Message-----
> > From: Allison, Timothy B. [mailto:tallison@mitre.org]
> > Sent: Monday, March 21, 2016 5:09 PM
> > To: dev@tika.apache.org
> > Subject: forbiddenapi's testCheck for Tika 2.0?
> >
> > All,
> > In sketching out the restructuring of test resources
> > (test-documents and general test code), I'm now getting an error
> > from forbidden api's
> testCheck.
> > The current proposal was to have a project called
> > "tika-test-resources" with no code in main and no code in test, just
> > the "test-documents" folder and other test resources.
> > The module tika-core now depends on tika-test-resources.
> >
> > When I tried this change, I saw that forbidden api's skipped "main"
> > in tika- test-resources because there were no class files. However,
> > it didn't skip "test," and it through a ClassNotFoundException for
> > CompositeParser...any idea what's going on?
> >
> >
> >
> >
> > [INFO] --- forbiddenapis:2.0:check (default) @ tika-test-resources
> > --- [INFO] Scanning for classes to check...
> > [WARNING] No classes found in 'C:\Users\tallison\Idea
> > Projects\tika-asf-git- 2_x\tika-test-resources\target\classes'
> > (includes=[**/*.class], excludes=null), forbiddenapis check skipped.
> > [INFO]
> > [INFO] --- forbiddenapis:2.0:testCheck (default) @
> > tika-test-resources
> > --- [INFO] Scanning for classes to check...
> > [INFO] Reading bundled API signatures: jdk-unsafe-1.7 [INFO] Reading
> > bundled API signatures: jdk-deprecated-1.7 [INFO] Reading bundled
> > API
> > signatures: commons-io-unsafe-2.4 [WARNING] Class
> > 'org.apache.commons.io.CopyUtils' not found on classpath while
> > parsing
> > signature:
> > org.apache.commons.io.CopyUtils#copy(byte[],java.io.Writer)
> > [signature ignored]
> >
> > ...
> > [INFO] Loading classes to check...
> > [INFO] Scanning classes for violations...
> > [INFO]
> > --------------------------------------------------------------------
> > --
> > --
> > [INFO] Reactor Summary:
> > [INFO]
> > [INFO] Apache Tika parent ................................ SUCCESS
> > [4.506s] [INFO] Apache Tika Test Resources ........................
> > FAILURE [19.216s] [INFO] Apache Tika core
> > .................................. SKIPPED ....
> >
> > [INFO]
> > --------------------------------------------------------------------
> > --
> > --
> > [INFO] BUILD FAILURE
> > [INFO]
> > --------------------------------------------------------------------
> > --
> > --
> > [INFO] Total time: 25.296s
> > [INFO] Finished at: Mon Mar 21 12:05:00 EDT 2016 [INFO] Final Memory:
> > 23M/437M [INFO]
> > --------------------------------------------------------------------
> > --
> > -- [ERROR] Failed to execute goal
> > de.thetaphi:forbiddenapis:2.0:testCheck
> > (default) on project tika-test-resources: Check for forbidden API
> > calls
> failed:
> > java.lang.ClassNotFoundException:
> > org.apache.tika.parser.CompositeParser
> > -> [Help 1]
> > [ERROR]
> >
>
RE: forbiddenapi's testCheck for Tika 2.0?
Posted by Uwe Schindler <uw...@thetaphi.de>.
Hi,
To disable: See the "bundle" plugin, put something like that into the pom.xml (copied from there):
<!-- The Tika Bundle has no java code of its own, so no need to do -->
<!-- any forbidden API checking against it (it gets confused...) -->
<plugin>
<groupId>de.thetaphi</groupId>
<artifactId>forbiddenapis</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
What may happen here is (I am not 100% sure because I cannot look into it - it is on your computer only): In the resources you have some *.class file for testing ASM parser. Of course, forbidden-apis picks that from the output folder "target/test-classes", because the test resources are copied there. In contrast to normal modules, the dependencies to parse this "demo" class file are missing -> failure. In my local checkout the test class resource is "AutoDetectParser.class", this would create the failure in isolation - of course.
Uwe
-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de
> -----Original Message-----
> From: Allison, Timothy B. [mailto:tallison@mitre.org]
> Sent: Tuesday, March 22, 2016 4:19 AM
> To: dev@tika.apache.org
> Subject: RE: forbiddenapi's testCheck for Tika 2.0?
>
> Thank you, Uwe.
>
> I did try "mvn clean," and that didn't work.
>
> Is there an easy way to disable it for just one module? Apologies for the
> likely dunceness of this question...
>
> -----Original Message-----
> From: Uwe Schindler [mailto:uwe@thetaphi.de]
> Sent: Monday, March 21, 2016 12:18 PM
> To: dev@tika.apache.org
> Subject: RE: forbiddenapi's testCheck for Tika 2.0?
>
> Hi,
>
> Theoretically it should also skip test files, but it will only do this if the folder
> does not exist in "output" dir (below "target/"). Maybe you missed to run
> "mvn clean" before testing?
>
> Otherwise you can also disable the plugin for the test-resources module.
>
> Uwe
>
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: uwe@thetaphi.de
>
>
> > -----Original Message-----
> > From: Allison, Timothy B. [mailto:tallison@mitre.org]
> > Sent: Monday, March 21, 2016 5:09 PM
> > To: dev@tika.apache.org
> > Subject: forbiddenapi's testCheck for Tika 2.0?
> >
> > All,
> > In sketching out the restructuring of test resources (test-documents
> > and general test code), I'm now getting an error from forbidden api's
> testCheck.
> > The current proposal was to have a project called
> > "tika-test-resources" with no code in main and no code in test, just
> > the "test-documents" folder and other test resources.
> > The module tika-core now depends on tika-test-resources.
> >
> > When I tried this change, I saw that forbidden api's skipped "main"
> > in tika- test-resources because there were no class files. However,
> > it didn't skip "test," and it through a ClassNotFoundException for
> > CompositeParser...any idea what's going on?
> >
> >
> >
> >
> > [INFO] --- forbiddenapis:2.0:check (default) @ tika-test-resources ---
> > [INFO] Scanning for classes to check...
> > [WARNING] No classes found in 'C:\Users\tallison\Idea
> > Projects\tika-asf-git- 2_x\tika-test-resources\target\classes'
> > (includes=[**/*.class], excludes=null), forbiddenapis check skipped.
> > [INFO]
> > [INFO] --- forbiddenapis:2.0:testCheck (default) @ tika-test-resources
> > --- [INFO] Scanning for classes to check...
> > [INFO] Reading bundled API signatures: jdk-unsafe-1.7 [INFO] Reading
> > bundled API signatures: jdk-deprecated-1.7 [INFO] Reading bundled API
> > signatures: commons-io-unsafe-2.4 [WARNING] Class
> > 'org.apache.commons.io.CopyUtils' not found on classpath while parsing
> > signature:
> > org.apache.commons.io.CopyUtils#copy(byte[],java.io.Writer) [signature
> > ignored]
> >
> > ...
> > [INFO] Loading classes to check...
> > [INFO] Scanning classes for violations...
> > [INFO]
> > ----------------------------------------------------------------------
> > --
> > [INFO] Reactor Summary:
> > [INFO]
> > [INFO] Apache Tika parent ................................ SUCCESS
> > [4.506s] [INFO] Apache Tika Test Resources ........................
> > FAILURE [19.216s] [INFO] Apache Tika core
> > .................................. SKIPPED ....
> >
> > [INFO]
> > ----------------------------------------------------------------------
> > --
> > [INFO] BUILD FAILURE
> > [INFO]
> > ----------------------------------------------------------------------
> > --
> > [INFO] Total time: 25.296s
> > [INFO] Finished at: Mon Mar 21 12:05:00 EDT 2016 [INFO] Final Memory:
> > 23M/437M [INFO]
> > ----------------------------------------------------------------------
> > -- [ERROR] Failed to execute goal
> > de.thetaphi:forbiddenapis:2.0:testCheck
> > (default) on project tika-test-resources: Check for forbidden API calls
> failed:
> > java.lang.ClassNotFoundException:
> > org.apache.tika.parser.CompositeParser
> > -> [Help 1]
> > [ERROR]
> >
>
RE: forbiddenapi's testCheck for Tika 2.0?
Posted by "Allison, Timothy B." <ta...@mitre.org>.
Thank you, Uwe.
I did try "mvn clean," and that didn't work.
Is there an easy way to disable it for just one module? Apologies for the likely dunceness of this question...
-----Original Message-----
From: Uwe Schindler [mailto:uwe@thetaphi.de]
Sent: Monday, March 21, 2016 12:18 PM
To: dev@tika.apache.org
Subject: RE: forbiddenapi's testCheck for Tika 2.0?
Hi,
Theoretically it should also skip test files, but it will only do this if the folder does not exist in "output" dir (below "target/"). Maybe you missed to run "mvn clean" before testing?
Otherwise you can also disable the plugin for the test-resources module.
Uwe
-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de
> -----Original Message-----
> From: Allison, Timothy B. [mailto:tallison@mitre.org]
> Sent: Monday, March 21, 2016 5:09 PM
> To: dev@tika.apache.org
> Subject: forbiddenapi's testCheck for Tika 2.0?
>
> All,
> In sketching out the restructuring of test resources (test-documents
> and general test code), I'm now getting an error from forbidden api's testCheck.
> The current proposal was to have a project called
> "tika-test-resources" with no code in main and no code in test, just
> the "test-documents" folder and other test resources.
> The module tika-core now depends on tika-test-resources.
>
> When I tried this change, I saw that forbidden api's skipped "main"
> in tika- test-resources because there were no class files. However,
> it didn't skip "test," and it through a ClassNotFoundException for
> CompositeParser...any idea what's going on?
>
>
>
>
> [INFO] --- forbiddenapis:2.0:check (default) @ tika-test-resources ---
> [INFO] Scanning for classes to check...
> [WARNING] No classes found in 'C:\Users\tallison\Idea
> Projects\tika-asf-git- 2_x\tika-test-resources\target\classes'
> (includes=[**/*.class], excludes=null), forbiddenapis check skipped.
> [INFO]
> [INFO] --- forbiddenapis:2.0:testCheck (default) @ tika-test-resources
> --- [INFO] Scanning for classes to check...
> [INFO] Reading bundled API signatures: jdk-unsafe-1.7 [INFO] Reading
> bundled API signatures: jdk-deprecated-1.7 [INFO] Reading bundled API
> signatures: commons-io-unsafe-2.4 [WARNING] Class
> 'org.apache.commons.io.CopyUtils' not found on classpath while parsing
> signature:
> org.apache.commons.io.CopyUtils#copy(byte[],java.io.Writer) [signature
> ignored]
>
> ...
> [INFO] Loading classes to check...
> [INFO] Scanning classes for violations...
> [INFO]
> ----------------------------------------------------------------------
> --
> [INFO] Reactor Summary:
> [INFO]
> [INFO] Apache Tika parent ................................ SUCCESS
> [4.506s] [INFO] Apache Tika Test Resources ........................
> FAILURE [19.216s] [INFO] Apache Tika core
> .................................. SKIPPED ....
>
> [INFO]
> ----------------------------------------------------------------------
> --
> [INFO] BUILD FAILURE
> [INFO]
> ----------------------------------------------------------------------
> --
> [INFO] Total time: 25.296s
> [INFO] Finished at: Mon Mar 21 12:05:00 EDT 2016 [INFO] Final Memory:
> 23M/437M [INFO]
> ----------------------------------------------------------------------
> -- [ERROR] Failed to execute goal
> de.thetaphi:forbiddenapis:2.0:testCheck
> (default) on project tika-test-resources: Check for forbidden API calls failed:
> java.lang.ClassNotFoundException:
> org.apache.tika.parser.CompositeParser
> -> [Help 1]
> [ERROR]
>
RE: forbiddenapi's testCheck for Tika 2.0?
Posted by Uwe Schindler <uw...@thetaphi.de>.
Hi,
Theoretically it should also skip test files, but it will only do this if the folder does not exist in "output" dir (below "target/"). Maybe you missed to run "mvn clean" before testing?
Otherwise you can also disable the plugin for the test-resources module.
Uwe
-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de
> -----Original Message-----
> From: Allison, Timothy B. [mailto:tallison@mitre.org]
> Sent: Monday, March 21, 2016 5:09 PM
> To: dev@tika.apache.org
> Subject: forbiddenapi's testCheck for Tika 2.0?
>
> All,
> In sketching out the restructuring of test resources (test-documents and
> general test code), I'm now getting an error from forbidden api's testCheck.
> The current proposal was to have a project called "tika-test-resources" with
> no code in main and no code in test, just the "test-documents" folder and
> other test resources.
> The module tika-core now depends on tika-test-resources.
>
> When I tried this change, I saw that forbidden api's skipped "main" in tika-
> test-resources because there were no class files. However, it didn't skip
> "test," and it through a ClassNotFoundException for CompositeParser...any
> idea what's going on?
>
>
>
>
> [INFO] --- forbiddenapis:2.0:check (default) @ tika-test-resources ---
> [INFO] Scanning for classes to check...
> [WARNING] No classes found in 'C:\Users\tallison\Idea Projects\tika-asf-git-
> 2_x\tika-test-resources\target\classes' (includes=[**/*.class],
> excludes=null), forbiddenapis check skipped.
> [INFO]
> [INFO] --- forbiddenapis:2.0:testCheck (default) @ tika-test-resources ---
> [INFO] Scanning for classes to check...
> [INFO] Reading bundled API signatures: jdk-unsafe-1.7
> [INFO] Reading bundled API signatures: jdk-deprecated-1.7
> [INFO] Reading bundled API signatures: commons-io-unsafe-2.4
> [WARNING] Class 'org.apache.commons.io.CopyUtils' not found on classpath
> while parsing signature:
> org.apache.commons.io.CopyUtils#copy(byte[],java.io.Writer) [signature
> ignored]
>
> ...
> [INFO] Loading classes to check...
> [INFO] Scanning classes for violations...
> [INFO] ------------------------------------------------------------------------
> [INFO] Reactor Summary:
> [INFO]
> [INFO] Apache Tika parent ................................ SUCCESS [4.506s]
> [INFO] Apache Tika Test Resources ........................ FAILURE [19.216s]
> [INFO] Apache Tika core .................................. SKIPPED
> ....
>
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 25.296s
> [INFO] Finished at: Mon Mar 21 12:05:00 EDT 2016
> [INFO] Final Memory: 23M/437M
> [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal de.thetaphi:forbiddenapis:2.0:testCheck
> (default) on project tika-test-resources: Check for forbidden API calls failed:
> java.lang.ClassNotFoundException: org.apache.tika.parser.CompositeParser
> -> [Help 1]
> [ERROR]
>