thanks to both Marks for investigating and also for the PR (https://github.com/apache/netbeans/pull/5282) - good teamwork.

couldn't quickly acquire a third Mark for review/merge so I merged it myself.

fix should appear in NetBeans 17.

-mbien


On 03.11.22 10:35, Mark Herkrath wrote:
Hi all,

I ran into the same issue. At least for me, it is happening every time a
parent pom is being used. That is for stand-alone/root poms referring to
parent poms not being part of the project's file structure, as well as for
multi-module poms where the parent pom is usually one level up in the file
structure. For stand-alone/root poms, it helps to define <relativePath/>
though, which is anyway recommended.

So I checked the source code, and found this in
org.netbeans.modules.maven.hints.pom.PomModelUtils:

public ModelSource2 getRelatedSource(String relative) {
     return new M2S(new File(pomFile, relative), null);
}

This is clearly incorrect as pomFile is a file, not a directory. It has to
be instead:
     return new M2S(new File(pomFile.getParentFile(), relative), null);

I have already tested and the issue is resolved thereafter.
Actual incorrect project file structures are correctly reported still. I
don't know when getRelatedSource(...) is being called elsewise. But like it
is now, no related source will be resolved correctly. So probably there are
other issues caused by it as well.

Now, I am not very keen to create a merge request. It is quite
time-consuming and not getting the credits is ok. So if possible, could a
NetBeans maintainer push this simple change, as it is just obvious? If that
is not feasible, alright, I will create the corresponding merge request.

Thanks,
Mark

On Sun, Oct 30, 2022 at 7:56 PM Mark Eggers <its_toas...@yahoo.com.invalid>
wrote:

Answers in-line. Thanks for any thoughts.

On 10/30/2022 6:53 AM, Eric Bresie wrote:
     1. Is the sub-projects within the parent projects folder structure or
     external?
The project is nested per Maven recommendations. The project was created
within NetBeans using the process I outlined in the original message.

     2. In the "parent" pom, did the "modules" for the sub-projects get
     defined?
    <modules>


      <module>MyServerModule</module>


      <module>MyClientModule</module>


      <module>MyPoCModule</module>

    </modules>

Note the extra blank lines.

     3. In the sub-projects, did the parent pom coordinates get included?
Yes, the parent element looks like the following (again, created by
NetBeans).

<parent>
      <artifactId>MyModules</artifactId>
      <groupId>org.mdeggers</groupId>
      <version>1.0-SNAPSHOT</version>
</parent>

     4. Which environment is maven running in on Windows (i.e. basic jar
on
     path based or installed in a Cygwin type environment)?

The Maven that is being run is included with NetBeans 16-rc2. I normally
run an installed NetBeans by specifying it in Tools->Options->Java->Maven.

Both are mavem 3.8.6.

On the command line maven is in my path (specified by a set of
environment variables) and unpacked in a Windows sub-directory.

I do not have any Java tools installed in either Cygwin or WSL2.

Again, NetBeans 13  (running on JDK 11) opens this project structure
with no errors.

. . . . just my two cents.
/mde/

Eric Bresie
ebre...@gmail.com


On Thu, Oct 27, 2022 at 6:07 PM Mark Eggers
<its_toas...@yahoo.com.invalid>
wrote:

It appears that images are stripped from the list.

The following should work:

https://i.postimg.cc/MpmPxK2n/module-error-edited.png

/mde/

On 10/27/2022 3:50 PM, Mark Eggers wrote:
Folks,

I am getting a warning about multi-module project structures and
parent.relativePath, but only on Windows (see screen shot).

To recreate:

1. Create a POM project
2. Right-mouse click on modules, and create a new module (Java
application)
3. Go into that new module and look at the created pom.xml

You'll get the warning (see screen shot) that the parent.relativePath
points to the module, rather than to the parent.

The project structure created by NetBeans (14,15,16-rc2) is correct,
but
the warning IMO is not. This warning does not appear on Windows in
NetBeans <= 13.

I created this screen shot in the following environment.

Windows 10 Professional
Java 17.0.3+7
NetBeans 16-rc2 (unpacked from the zip file)

The following items were added to netbeans.conf:

# adding UTF-8 and fontsize at the end
netbeans_default_options=" . . . . -J-Dfile.encoding=UTF-8 --fontsize
14"
# location of JDK 17 - run JDK 11 by default on this machine
netbeans_jdkhome="D:\Programs-x64\Java\jdk-17.0.3+7"

I did not import any settings, and did not pre-activate any modules.

Right now since it's a warning, I just ignore it.

Please also note in the screen shot, pom.xml is created with Unix (LF)
endings instead of Windows (CRLF) endings. However, a Java Web
application created as a module in this project shows Windows (CRLF)
for
pom.xml

The warnings do not show up when following the same procedure on Ubuntu
20.04.1.

Could this be due to line ending confusion? I have the following
project
structure:

MyModules - pom.xml is in Unix (LF) format (POM project)
      |
      MyServerModule - pom.xml is in Unix (LF) format (Java application)
      |
      MyClientModule - pom.xml is in Windows (CRLF) format (Web
application)
      |
      MyPoCModule - pom.xml is in Windows (CRLF) format (Web
application)
If someone can point me in the general direction of where to look, I'd
be happy to try and narrow it down further.

. . . just my two cents
/mde/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@netbeans.apache.org
For additional commands, e-mail: dev-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@netbeans.apache.org
For additional commands, e-mail: dev-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@netbeans.apache.org
For additional commands, e-mail: dev-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists






---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@netbeans.apache.org
For additional commands, e-mail: dev-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



Reply via email to