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 232399 - Maven project Run action: process-test-resources as default goal instead of process-classes
Summary: Maven project Run action: process-test-resources as default goal instead of p...
Status: RESOLVED WONTFIX
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.3.1
Hardware: PC Linux
: P4 normal with 1 vote (vote)
Assignee: Milos Kleint
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-08 15:59 UTC by pekarna
Modified: 2013-09-19 12:59 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pekarna 2013-07-08 15:59:26 UTC
1) Have a Maven project
2) Check it's properties -> Actions -> Run Project

The default "Execute Goals" value is

   process-classes org.codehaus.mojo:exec-maven-plugin:1.2:exec

The things is, that some projects, during the tests, rely on the same environment as when running. Which means - during test preparation phases, they build things like config files, database etc. The phases are:

...
process-classes
generate-test-sources
process-test-sources
generate-test-resources
process-test-resources
test-compile
process-test-classes
...

It is quite logical to run up to "process-test-resources" as default goal instead of process-classes. It would not compile or run tests, but would create the environment.

I think it would do no harm to some simple projects, it would not affect old projects (not sure - are the values stored even if they are untouched?), and not many project would mind running those phases in addition before running.

Thanks for considering.

I'm setting this P4 as it can be easily changed by hand.
Comment 1 Milos Kleint 2013-07-08 19:34:41 UTC
if you have such requirement, you can rewrite the mapping on a per-project basis in project customizer.

It appears to me that if the environment is required when running a main class from main sources, then the resources(environment) should also be build at phases related to main sources, not test sources.

Please note that when running a main class in test sources, we replace the phase from process-classes to process-test-classes automatically behind the scene.
Comment 2 Milos Kleint 2013-09-19 12:59:29 UTC
(In reply to Milos Kleint from comment #1)
> Please note that when running a main class in test sources, we replace the
> phase from process-classes to process-test-classes automatically behind the
> scene.

Just double checked, Run file action when invoked on a main-class from test source root executes process-test-classes phase correctly. Given that Compile on Save is turned off. CoS is on by default in 7.4.

closing as wontfix. Run project is designed to work on main sources main-classes only. Run File however works for both main and test source roots correctly as far as I can tell. If your main sources rely on test related phases, then it's a clear corner case for the IDE and possibly something wrong with your build.