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 253313 - settings.xml in external non-bundled maven installation ignored
Summary: settings.xml in external non-bundled maven installation ignored
Status: RESOLVED WORKSFORME
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 8.1
Hardware: PC Windows 7
: P2 normal with 1 vote (vote)
Assignee: Tomas Stupka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-05 23:30 UTC by bht
Modified: 2015-07-16 09:18 UTC (History)
0 users

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 bht 2015-07-05 23:30:11 UTC
The local repository location is set in the external maven installation conf/settings.xml as follows:

<localRepository>user repo loacation here</localRepository>

Otherwise no special settings in this file, in particular NO proxy settings.

The same is applied to the settings.xml in the NetBeans bundled maven installation dir.


The proxy settings are configured in the settings.xml file in the local repository - nowhere else.

If the selection is Menu|Tools|Options|Maven|Maven Home|Bundled

then the build succeeds.

However if the selection is Menu|Tools|Options|Maven|Maven Home|<External maven installation, version 3.1.0>

cd C:\Users\btreine\AppData\Local\anon\project; JAVA_HOME=C:\\Users\\btreinethen the build fails.

Connection to http://repo.maven.apache.org refused: Connection timed out:

It appears that NetBeans does not use the settings.xml in the configured repo location when using the external maven installation.

I also notice that in both cases, the file settings.xml is not shown in Projects dir under project "Project Files" directory.

So there are 2 problems actually.

My overall objective is to set my local repository and my settings.xml in a central location in a clean way, centrally. I haven't found a way to do this yet. IMHO this is a simple objective and it should have a simple answer.
Comment 1 Tomas Stupka 2015-07-15 14:44:26 UTC
the ide merely invokes a maven cli command and what settings.xml file is taken in count is completely given by maven. The same way it would react in case you would invoke it from the command line. Or does this work for you differently from cli?

When you run the build with debug options (click the yellow arrow in output view and select show debug out), then somewhere in the beginning of the output you will see what global and user settings files are used for the execution.
Comment 2 bht 2015-07-15 23:44:11 UTC
The issue I had is as follows:

In the external maven installation dir settings.xml, I redirect to custom settings.xml indirectly via:
<localRepository>user repo location here</localRepository>. This repo is NOT in the user home. I do NOT have a repo in user home.

If in <user repo location> settings.xml, proxy settings are defined, then maven ignores them.

Instead maven tries to read settings.xml fom user home .m2. If no such file exists then Maven silently ignores this even with full debug, -X setting!!!

NetBeans does not show settings.xml in Projects window because it cannot find the file.

I could suggest an improvement where NetBeans in case of user home based .m2 settings.xml not found, instead in the Projects window links to settings.xml in the the active maven installation (depending on maven installation used in options).
Comment 3 Tomas Stupka 2015-07-16 09:18:40 UTC
> The issue I had is as follows:
> In the external maven installation dir settings.xml, I redirect to custom settings.xml indirectly via:
> <localRepository>user repo location here</localRepository>. This repo is NOT in the user home. I do NOT have a repo in user home.
no. <localRepository> is used to specify the path to the repository, not where the user settings.xml lies

from the official maven doc
There are two locations where a settings.xml file may live:

The Maven install: $M2_HOME/conf/settings.xml
A user’s install: ${user.home}/.m2/settings.xml

https://maven.apache.org/settings.html

> If in <user repo location> settings.xml, proxy settings are defined, then maven ignores them.
> Instead maven tries to read settings.xml fom user home .m2. If no such file exists then Maven silently ignores this even with full debug, -X setting!!!
> NetBeans does not show settings.xml in Projects window because it cannot find the file.
note that also the default repo path - ${user.home}/.m2/repository isn't the folder in which settings.xml is

with other words - you pointed maven to an alternative repository, but not to an alternative user settings.xml