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 189833 - Is 'mvn --offline' mode when loading projects desirable?
Summary: Is 'mvn --offline' mode when loading projects desirable?
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.0
Hardware: All All
: P2 normal (vote)
Assignee: _ theanuradha
URL:
Keywords: UI
: 190444 (view as bug list)
Depends on: 193021 195440
Blocks: 189727
  Show dependency tree
 
Reported: 2010-08-25 11:41 UTC by Antonin Nebuzelsky
Modified: 2014-03-10 07:46 UTC (History)
4 users (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 Antonin Nebuzelsky 2010-08-25 11:41:50 UTC
Offline mode is used for Maven when opening projects.

For some projects it causes user visible problems when first opening the project.

We should consider if this is acceptable or if we can improve it somehow (better indication of the project status to the user, or maybe trying to use online mode when needed - but this must not cause other problems of performance kind or blocking the IDE because network connection may not be available). 

To reproduce:

* clean up your local maven repository (~/.m2/repository)

* checkout glassfish project from
https://svn.dev.java.net/svn/glassfish-svn/trunk/v3

* navigate to the v3 folder in Open Project dialog

* the Project Name of the highlighted folder is displayed as "<misconfigured Maven project>"

* when you open the project it is displayed with this name in the Projects view

* the tooltip on the project and the text in Show and Resolve Problems dialog is saying:

Unable to properly load project

1 problem was encountered while building the effective model for org.glassfish:glassfish-parent:3.1-SNAPSHOT
[FATAL] Non-resolvable parent POM org.glassfish:pom:8 for org.glassfish:glassfish-parent:3.1-SNAPSHOT: Failed to resolve POM for org.glassfish:pom:8 due to The repository system is offline and the requested artifact is not locally available at /home/tonda/.m2/repository/org/glassfish/pom/8/pom-8.pom
  org.glassfish:pom:pom:8
from the specified remote repositories:
  central (http://repo1.maven.org/maven2, releases=true, snapshots=false)
 @ 
 for project org.glassfish:glassfish-parent:3.1-SNAPSHOT at /home/tonda/svn/gf/v3/pom.xml

* when you invoke Revalidate in the Show and Resolve Problems dialog, the missing parent POMs are downloaded (without building the project) and the problem disappears
Comment 1 Jesse Glick 2010-08-25 12:19:57 UTC
So the issue here is that org.glassfish:pom:8 is unavailable in the local repo. It is not even in the v3 source tree; you would need to check out https://svn.dev.java.net/svn/glassfish-svn/tags/master-pom-8/ to add it locally by 'mvn install', so people would usually simply download it. Maven will refuse to load a project whose parent POM is missing, naturally enough.

I'm not sure if NB 6.9 loaded the project in "online" mode, thus forcing the artifact to be downloaded via HTTP when the project was opened. But it did inject "dummy POMs" during artifact resolution (cf. NbArtifact) as placeholders for those which were missing. This logic could easily be recreated (now in NbArtifactFixer), but it is problematic. In this example, the parent POM specifies (among other things)

            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>

which is a critical piece of configuration for the IDE's source code editor, which would be missed if you loaded the project with a dummy POM. I am inclined to mark the project as incomplete rather than pretend to load it but actually omit this kind of configuration.

Clicking "Revalidate" is the currently recommended way to fix the problem; it downloads the parent POM and makes it available for loading within the IDE, as well as for command-line builds.

But we can also consider having the IDE attempt an online reload asynchronously after the project is initially loaded with a fatal error like this - triggered either after loading or opening. (Performing a synchronous online reload during project load is I think unacceptable since it could block critical IDE queries, project opening, etc.)

An online reload would be the rough equivalent of running "Revalidate" automatically on your behalf, except that it would use the embedded Maven, not forking the external Maven as "Revalidate" does ('mvn validate'). If this works we could consider removing the "Revalidate" fix (bug #189727) since it would not be likely to fix any additional problems; it could still be useful for demonstrating to the user that a problem in your POM is real (as far as command-line Maven is concerned), not just an IDE bug. There might be obscure circumstances where running CLI Maven would be better for downloading missing artifacts, e.g. if you have a special proxy setup or a repository manager that the embedder does not understand, though you could just press F11 or run any other goal to accomplish this as well.
Comment 2 Petr Jiricka 2010-08-26 11:40:16 UTC
>  I am inclined to mark the project as incomplete rather than pretend to...

Agreed, I think the 6.9 way had its own problems, and marking the project as incomplete is better. However, currently the project is labeled as "misconfigured", which is misleading, and has a different meaning than "incomplete". Actually, even "incomplete" does not capture the right meaning - how about <partially loaded Maven project> ?

> But we can also consider having the IDE attempt an online reload asynchronously
> after the project is initially loaded with a fatal error like this

+1, good idea.
Comment 3 Jesse Glick 2010-09-20 13:48:26 UTC
*** Bug 190444 has been marked as a duplicate of this bug. ***
Comment 4 Jesse Glick 2010-09-24 15:45:03 UTC
core-main #d73f986cfd5c ~ core-main #fdb2b61dd52b (merge problems)
Comment 5 Jesse Glick 2010-09-24 17:20:38 UTC
(In reply to comment #0)
> * checkout glassfish project from
> https://svn.dev.java.net/svn/glassfish-svn/trunk/v3

You will probably want to also apply:

https://glassfish.dev.java.net/issues/show_bug.cgi?id=13614
Comment 6 Jesse Glick 2010-09-24 19:24:50 UTC
*** Bug 190444 has been marked as a duplicate of this bug. ***
Comment 7 Marian Mirilovic 2014-03-10 07:46:15 UTC
*** Bug 190444 has been marked as a duplicate of this bug. ***