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 165576 - Maven classpath ignored when running individual file
Summary: Maven classpath ignored when running individual file
Status: RESOLVED WONTFIX
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 6.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: Milos Kleint
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-20 09:27 UTC by getaceres
Modified: 2009-11-02 11:03 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description getaceres 2009-05-20 09:27:18 UTC
I have a Maven project with some runnable files inside. In netbeans 6.5, when I select "Run File" it gets compiled and
is run with the Maven dependencies in the classpath. When I try the same in Netbeans 6.7 beta, I get a NoClassDefFound
exception with a class that should be in a Maven dependency.
Comment 1 Milos Kleint 2009-05-20 10:35:58 UTC
did you customize the action mapping?
do you have an external maven setup for use in the IDE?
is the class not found coming from a runtime or compilation dependency?
Comment 2 Jaroslav Pospisil 2009-05-20 12:13:14 UTC
Could you please add more info about your project? I've just checked and even i 6.7 Run File works with common use cases.
Comment 3 getaceres 2009-05-20 12:51:10 UTC
In the "Actions" section, I have checked the "Use external maven for build executions". If I uncheck it, it gets checked
again automatically the next time that I open the properties dialog. The project that I'm trying to run is a subproject
of another but I cannot uncheck it in the parent project either. If I put the mouse on the ckeckbox I get a tooltip that
says:

"Value is inherited from parent pom or default"

In the Maven configuration tab (in Netbeans options). I get two messages:

(Embedded Maven Version: 3.0-SNAPSHOT)

the External Maven Home input is empty but below it I have:

Using Default Maven Version: 2.0.9 (as found on PATH)

The class not found is org/apache/commons/logging/LogFactory which is part of Apache Commons Logging. I have this
dependency as provided because my project is JBoss specific and I know for sure that it's going to be in the classpath
when it executes and I don't want to propagate this dependency. Anyway, the same POM in Netbeans 6.5 executes the file,
so it's a problem with Netbeans 6.7.
Comment 4 Milos Kleint 2009-05-20 13:06:14 UTC
unfortunately this is unfixable. The fact that is worked in 6.5 is strange and probably a bug. A provided dependency is not put on runtime classpath (in exec-
maven-plugin 1.1 - as used in 6.5 - the compilation classpath was used, that was a bug, but seemed to probably cause the "correct" effect for you.

the problem is that for execution of the app, the dependency is provided by for the execution via exec-maven-plugin it's not.. I don't see a way to fix it 
generally, the workaround for you is to setup a profile that defines the dependency as runtime and activate the profile in Run file action mapping.

closing as LATER, no way to fix now, we might revisit once (if) we use a different method of execution
Comment 5 Quality Engineering 2009-11-02 11:03:39 UTC
NetBeans.org Migration: changing resolution from LATER to WONTFIX