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 218145 - Allow setting custom settings.xml
Summary: Allow setting custom settings.xml
Status: NEW
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.4
Hardware: All All
: P2 normal with 8 votes (vote)
Assignee: Tomas Stupka
URL:
Keywords:
: 240059 (view as bug list)
Depends on: 197577
Blocks:
  Show dependency tree
 
Reported: 2012-09-11 14:44 UTC by pekarna
Modified: 2016-11-14 08:52 UTC (History)
1 user (show)

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 2012-09-11 14:44:34 UTC
Large projects often have their own settings.xml as their build process can't rely on m2/settings.xml.

Currently, NetBeans 7.2 does not allow to set settings.xml for a project.
A workaround for building is to put e.g. 
   -s build/config/settings.xml 
to all Actions in project's properties.
However, this still leaves the project marked as "unloadable" and renders NetBeans almost unusable as code completion, dependency resolution, etc do not work.

All this could be fixed by allowing the project to have custom settings.xml, which would be applied instead of default settings.xml, and also, added to the command line for Maven invocations.

This property should also be applied automatically to all project's Maven submodules not to force user to set it for each module manually.
Comment 1 Milos Kleint 2012-09-11 14:50:53 UTC
very related to issue 197577.

there will never be a per project settings file. There is too much loose coupling between projects that per-project settings would break in more or less subtle ways.

 In post 7.3 we should get a set of per project group settings, like maven executable and/or settings file and/or local repository.

(in 7.3 the off-UI workaround is to have the maven installation's settings file to  contain the appropriate settings. The workaround is described in issue 197577
Comment 2 rptmaestro 2013-09-27 17:10:16 UTC
I'm glad to see that the "Project Group Properties" now include a Maven settings panel. I think the ability to set a custom Maven home is a great addition.

The only thing I can currently think of that would make this new feature even more valuable would be to supply a project group setting for "Global Execution Options". This would allow for supplying a custom settings.xml for a project group. This would be useful for the following use cases:

1) My company provides its own Maven repository and we use need to make our local settings.xml match that of the continuous build server to mirror all external repositories (e.g. central) so that dependencies will be resolved only from the internal repository. This ensures that our developers aren't inadvertently using "unapproved" dependencies, or dependencies with licenses that could bring risk to the organization. But when I switch to a different project group for personal or open source projects, I don't want to use that mirror, so I have to manually go into settings.xml and comment out that piece of configuration whenever I switch project groups. Being able to supply this via the "Global Execution Options" field would eliminate the need for this manual process.

2) I recently attended Spring Core and Enterprise training. Their labs reference a repository not available to the public but the training software provided a local repository for dependency resolution. Not wanting to use STS/Eclipse for the labs, I needed to configure my settings.xml so that NetBeans would pull from this local repository in offline mode. But again, when I change to personal, work, or open source projects, I have to remember to manually comment out these lines in my settings.xml file.

There may be other command-line options that would be similarly useful on a per-group basis such as specifying custom heap and permgen sizes for the maven build or supplying custom global system properties, so the addition of a "Global Execution Options" (perhaps labeled as "Group Execution Options") would be invaluable.
Comment 3 Milos Kleint 2014-01-22 08:55:23 UTC
*** Bug 240059 has been marked as a duplicate of this bug. ***
Comment 4 everflux 2016-08-13 06:55:41 UTC
Any update on this? Would be really helpful for people working with different setups/customers.
Comment 5 everflux 2016-08-13 07:25:34 UTC
Note: Using the ".mvn/maven.config" to configure a settings.xml per project works only for CLI builds, not for NetBeans.
I assume this is due to NetBeans building modules separately and then a relative path is resolved differently then by a complete build from the top level. (This is discussed in https://issues.apache.org/jira/browse/MNG-5767 )
Besides NetBeans does not pick up the settings and associated configuration. (I wanted to have a different folder for the local maven repository)
Comment 6 lforet 2016-11-14 08:52:10 UTC
Is there any update for the next release ?

I understand that it is very difficult/impossible to apply a different settings per project. But, the Project groups seems to be the good granularity to apply the settings configuration. In 8.2, the maven project group properties only contains the maven home choice. 

It will be great to be able to specify the settings.xml configuration for the group in this panel.
 
Indeed, for instance the workaround for me is for each different settings I want to apply, I use a different maven-home with its own global-setting, and remove the user specific settings.