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.
Summary: | Running applications fails when classpath to long | ||
---|---|---|---|
Product: | projects | Reporter: | sgtgarcia <sgtgarcia> |
Component: | Maven | Assignee: | David Simonek <dsimonek> |
Status: | RESOLVED DUPLICATE | ||
Severity: | blocker | CC: | anebuzelsky, uprooter |
Priority: | P3 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | Windows XP | ||
Issue Type: | DEFECT | Exception Reporter: |
Description
sgtgarcia
2008-11-21 14:26:30 UTC
unfortunately the netbeans-run-plugin required clumsy configuration of the pom.xml and required the mvn install phase to be run along with copying the dependency jars to target/ folder. That's inherently slow. It also required embedded maven for it's invokation, which is unfortunately buggy and incompatible with latest release of maven and was causing problems to people with more complex setups. exec-maven-plugin shall be more generic, requires no pom customization and is faster. 1. runtime vs. compile. Compile seems to be the default scope, no idea why. However currently setting the classpath scope to runtime will not include the output directory (exec plugin bug). in post 6.5 when executed main method in test sources, the test scope shall be already used 2. too long command is a real problem without a clear solution so far. At least to me. any insights welcome My current workaround: In pom.xml, I use a mix of Jar and Assembly plugin to build a jar with classpath included in Manifest pointing to librairies in gathered in a local folder <plugin> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> <classpathPrefix>lib</classpathPrefix> <mainClass>com.mycompany.myapp.Main</mainClass> </manifest> </archive> </configuration> </plugin> <plugin> <artifactId>maven-assembly-plugin</artifactId> <executions> <execution> <phase>package</phase> <goals> <goal>directory-inline</goal> </goals> <configuration> <descriptors> <descriptor>assembly-descriptor.xml</descriptor> </descriptors> <finalName>myapp</finalName> </configuration> </execution> </executions> </plugin> And then use Exec plugin to start app from NetBeans (nbactions.xml): <actions> <action> <actionName>run</actionName> <goals> <goal>package</goal> <goal>org.codehaus.mojo:exec-maven-plugin:1.1:exec</goal> </goals> <properties> <exec.workingdir>${project.build.directory}/working-dir</exec.workingdir> <exec.args>-jar ${project.build.finalName}.jar</exec.args> <exec.executable>java</exec.executable> </properties> </action> <action> <actionName>debug</actionName> <goals> <goal>package</goal> <goal>org.codehaus.mojo:exec-maven-plugin:1.1:exec</goal> </goals> <properties> <exec.args>-Xdebug -Djava.compiler=none -Xnoagent -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -jar ${project.build.finalName}.jar</exec.args> <exec.workingdir>${project.build.directory}/working-dir</exec.workingdir> <jpda.listen>true</jpda.listen> <exec.executable>java</exec.executable> </properties> </action> </actions> As you stated, this is not quick, but works: runtime dependencies+compile are included and as classpath is described in manifest there is no problem of command length. runtime vs. compile classpath is fixed in 7.0 M2 (using exec-maven-plugin 1.1.1) the classpath length issue still persists, I chnaged the summary accordingly. *** Issue 154467 has been marked as a duplicate of this issue. *** *** Issue 158564 has been marked as a duplicate of this issue. *** could you tell me if thisbug is fixed in 6.7 m2 ? If not when will this be fixed ?? Thanks *** Issue 167311 has been marked as a duplicate of this issue. *** http://jira.codehaus.org/browse/MEXEC-68 is the issue filed against the exec-maven-plugin. http://support.microsoft.com/kb/830473 it says maximum length on XP is 8191 chars. on linux it's about ~32000 This problem is not really windows specific. it just a matter of time until some linux user will create a huge project on a wired long path and get this error as well. I tried very hard to use sgtgarcia solution but it didn't work. Any further explanation/comments will be very appreciated as I'm very stuck on this one. some day this bug just showed up, probably after adding deps. Can't debug/run any of my maven projects on windows and my project mates are very upset. @uprooter A robust workaround for this is to create a second project to wrap the first that delegates the classpath management to classworlds http://classworlds.codehaus.org/ This is bit of a pain but works well. If anyone is still using a version of Netbeans for the runtime path issue isn't fixed you can work around it byrolling the exec plugin back to 1.1-Beta-1. the too long classpath problem should be fixed in current svn trunk of the exec-maven-plugin codebase. I've deployed a snapshot for testing at http://snapshots.repository.codehaus.org/org/codehaus/mojo/exec-maven-plugin/1.1.2-SNAPSHOT/ to use it, declare the s.r.c.org repository in settings.xml file and then change the action mapping in the IDE to 1.1.2-SNAPSHOT (instead of the current 1.1.1) thanks. Presumably fixed by integration in issue 188864. *** This bug has been marked as a duplicate of bug 188864 *** Someone should verify that this is indeed fixed - sgtgarcia, could we ask you to verify with dev build? Thanks. |