This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 211297 - NbModuleSuite: 'read wrong amount' error on building NBP application with Maven
Summary: NbModuleSuite: 'read wrong amount' error on building NBP application with Maven
Status: RESOLVED DUPLICATE of bug 207646
Alias: None
Product: apisupport
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.1.1
Hardware: PC Mac OS X
: P3 normal (vote)
Assignee: Jesse Glick
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-17 06:53 UTC by mbastian
Modified: 2012-05-08 08:10 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Project archive. NBP Maven Application + One module with the processing dependency (38.73 KB, application/zip)
2012-04-17 06:53 UTC, mbastian
Details
processing JAR (178.73 KB, application/java-archive)
2012-04-17 06:55 UTC, mbastian
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mbastian 2012-04-17 06:53:34 UTC
Created attachment 118373 [details]
Project archive. NBP Maven Application + One module with the processing dependency

I have issues building a Netbeans Platform application with Maven with a particular library. It works fine until I include this library as a dependency of a module. This library is processing 1.5.1 (http://processing.org), which is unfortunately not available in central. The library doesn't have any dependency and I installed it locally. The library's JARs seems totally fine ans is widely used.

Way to reproduce:
1) Create a new NBP Maven application
2) Create a new module and add it as a dependency to the application
3) Build with dependencies the app to verify it works fine.
4) Now add org.processing as a dependency to the module.
5) Build with dependencies the application. The surefire test fails with the following error:

-------------------------------------------------------------------------------
Test set: test.netbeans.bugmaven.ApplicationTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.903 sec <<< FAILURE!
org.netbeans.junit.NbModuleSuite$S@288051(org.netbeans.junit.NbModuleSuite$S)  Time elapsed: 0 sec  <<< ERROR!
java.io.IOException: read wrong amount
	at org.netbeans.junit.NbModuleSuite$S.rewrite(NbModuleSuite.java:1146)
	at org.netbeans.junit.NbModuleSuite$S.turnClassPathModules(NbModuleSuite.java:1080)
	at org.netbeans.junit.NbModuleSuite$S.runInRuntimeContainer(NbModuleSuite.java:855)
	at org.netbeans.junit.NbModuleSuite$S.access$100(NbModuleSuite.java:660)
	at org.netbeans.junit.NbModuleSuite$S$1.protect(NbModuleSuite.java:679)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at org.netbeans.junit.NbModuleSuite$S.run(NbModuleSuite.java:677)
	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
	at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
	at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
	at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)

I'm adding a projet test archive and the dependency JAR (core-1.5.1.jar).
Comment 1 mbastian 2012-04-17 06:55:03 UTC
Created attachment 118374 [details]
processing JAR

Library JAR for the org.processing dependency:

<dependency>
   <groupId>org.processing</groupId>
   <artifactId>core</artifactId>
   <version>1.5.1</version>
</dependency>
Comment 2 Jesse Glick 2012-04-17 12:11:10 UTC

*** This bug has been marked as a duplicate of bug 207646 ***
Comment 3 mbastian 2012-04-17 15:21:37 UTC
I tested on the latest nightly build and the problem remains the same.
Comment 4 Jesse Glick 2012-04-17 15:30:31 UTC
What version of the IDE you are using is irrelevant. It only matters what version of nbjunit you are using in the project's dependencies - RELEASE711 according to your attachment. You can add the NB snapshot repo [1] and try switching the version of org.netbeans.api:org-netbeans-modules-nbjunit to SNAPSHOT in application/pom.xml.

[1] http://bits.netbeans.org/netbeans/trunk/maven-snapshot/
Comment 5 mbastian 2012-04-18 04:23:30 UTC
Thanks Jesse. That makes sense. 

I tried what you suggest using the SNAPSHOT version of the nbjunit module but the test is freezing and I have to kill it.  The surefire report doesn't contain anything after that. That happens on a newly created project without any external dependencies as well.

Can someone reproduce that? Thanks.
Comment 6 mgrote 2012-05-08 08:10:00 UTC
I could reproduce the freezing of the SNAPSHOT-version. Working with the nightly build 201205020400 produces also the same IOException with my project. What me helped was to change the copy-mechanism in the NbModuleSuite.java beginning from line 1144 to a slow bitwise copy. Ok, it´s less than optimal, but the error is blown away.