You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Jason van Zyl (JIRA)" <ji...@codehaus.org> on 2006/12/31 06:18:11 UTC

[jira] Created: (MNG-2722) Create a strategy for providing sane default values in the MavenExecutionRequest

Create a strategy for providing sane default values in the MavenExecutionRequest
--------------------------------------------------------------------------------

                 Key: MNG-2722
                 URL: http://jira.codehaus.org/browse/MNG-2722
             Project: Maven 2
          Issue Type: Task
          Components: Embedding
            Reporter: Jason van Zyl


Ideally an Embedder user should be able to do something like:

MavenEmbedder embedder = new MavenEmbedder();

MavenExecutionRequestion request = new DefaultMavenExecutionRequestion()
  .setBasedir( directory )
  .setGoals( Arrays.asList( new String[]{ "package" } ) );

embedder.execute( request );

And this should work.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (MNG-2722) Create a strategy for providing sane default values in the MavenExecutionRequest

Posted by "Jason van Zyl (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-2722?page=all ]

Jason van Zyl closed MNG-2722.
------------------------------

    Resolution: Fixed

> Create a strategy for providing sane default values in the MavenExecutionRequest
> --------------------------------------------------------------------------------
>
>                 Key: MNG-2722
>                 URL: http://jira.codehaus.org/browse/MNG-2722
>             Project: Maven 2
>          Issue Type: Task
>          Components: Embedding
>            Reporter: Jason van Zyl
>
> Ideally an Embedder user should be able to do something like:
> MavenEmbedder embedder = new MavenEmbedder();
> MavenExecutionRequestion request = new DefaultMavenExecutionRequestion()
>   .setBasedir( directory )
>   .setGoals( Arrays.asList( new String[]{ "package" } ) );
> embedder.execute( request );
> And this should work.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MNG-2722) Create a strategy for providing sane default values in the MavenExecutionRequest

Posted by "Aaron Digulla (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MNG-2722?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_85989 ] 

Aaron Digulla commented on MNG-2722:
------------------------------------

After some more tests, my patch doesn't seem the fix the localRepository problem.

localRepository  is only read when it is specified in ~/.m2/settings.xml. If it is specified in the file specified with setGlobalSettingsFile(), it's ignored.

It also doesn't fix the issue MNGECLIPSE-231 as I had hoped :-(

All I can say is that defaultsPopulator doesn't fill in the correct local repository when it is called in MavenEmbedder.

> Create a strategy for providing sane default values in the MavenExecutionRequest
> --------------------------------------------------------------------------------
>
>                 Key: MNG-2722
>                 URL: http://jira.codehaus.org/browse/MNG-2722
>             Project: Maven 2
>          Issue Type: Task
>          Components: Embedding
>            Reporter: Jason van Zyl
>         Attachments: embedder-start-twice.patch
>
>
> Ideally an Embedder user should be able to do something like:
> MavenEmbedder embedder = new MavenEmbedder();
> MavenExecutionRequestion request = new DefaultMavenExecutionRequestion()
>   .setBasedir( directory )
>   .setGoals( Arrays.asList( new String[]{ "package" } ) );
> embedder.execute( request );
> And this should work.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MNG-2722) Create a strategy for providing sane default values in the MavenExecutionRequest

Posted by "Aaron Digulla (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MNG-2722?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_87921 ] 

Aaron Digulla commented on MNG-2722:
------------------------------------

Sorry, wrong issue. The path to the local repository is still not used when it is defined in the global settings. But a lot of other ClassWorld issues have been resolved with the latest embedder version.

> Create a strategy for providing sane default values in the MavenExecutionRequest
> --------------------------------------------------------------------------------
>
>                 Key: MNG-2722
>                 URL: http://jira.codehaus.org/browse/MNG-2722
>             Project: Maven 2
>          Issue Type: Task
>          Components: Embedding
>            Reporter: Jason van Zyl
>         Attachments: embedder-start-twice.patch
>
>
> Ideally an Embedder user should be able to do something like:
> MavenEmbedder embedder = new MavenEmbedder();
> MavenExecutionRequestion request = new DefaultMavenExecutionRequestion()
>   .setBasedir( directory )
>   .setGoals( Arrays.asList( new String[]{ "package" } ) );
> embedder.execute( request );
> And this should work.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (MNG-2722) Create a strategy for providing sane default values in the MavenExecutionRequest

Posted by "Aaron Digulla (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-2722?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aaron Digulla updated MNG-2722:
-------------------------------

    Attachment: embedder-start-twice.patch

This fix causes all kinds of problems in various Maven plugins if you have to change the settings, for example, by calling start() a second time with a different settings.xml file (setUserSettingsFile() and setGlobalSettingsFile()) because some parts of Maven don't copy the new values.

In the attached test case, you'll find a couple of bugs:

- The embedder crashes horribly if you change the localRepository path to an empty directory (see stacktrace in the test case).
- The path to the repository is correct in the embedder but not in the execution request if the second settings file specifies localRepository

My guess is that this causes all kinds of strange bugs and behaviors in the plugins which are then loaded.

> Create a strategy for providing sane default values in the MavenExecutionRequest
> --------------------------------------------------------------------------------
>
>                 Key: MNG-2722
>                 URL: http://jira.codehaus.org/browse/MNG-2722
>             Project: Maven 2
>          Issue Type: Task
>          Components: Embedding
>            Reporter: Jason van Zyl
>         Attachments: embedder-start-twice.patch
>
>
> Ideally an Embedder user should be able to do something like:
> MavenEmbedder embedder = new MavenEmbedder();
> MavenExecutionRequestion request = new DefaultMavenExecutionRequestion()
>   .setBasedir( directory )
>   .setGoals( Arrays.asList( new String[]{ "package" } ) );
> embedder.execute( request );
> And this should work.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MNG-2722) Create a strategy for providing sane default values in the MavenExecutionRequest

Posted by "Aaron Digulla (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MNG-2722?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_87920 ] 

Aaron Digulla commented on MNG-2722:
------------------------------------

This seems to be fixed with the latest embedder sources (2.1.0.20070213-1647)

> Create a strategy for providing sane default values in the MavenExecutionRequest
> --------------------------------------------------------------------------------
>
>                 Key: MNG-2722
>                 URL: http://jira.codehaus.org/browse/MNG-2722
>             Project: Maven 2
>          Issue Type: Task
>          Components: Embedding
>            Reporter: Jason van Zyl
>         Attachments: embedder-start-twice.patch
>
>
> Ideally an Embedder user should be able to do something like:
> MavenEmbedder embedder = new MavenEmbedder();
> MavenExecutionRequestion request = new DefaultMavenExecutionRequestion()
>   .setBasedir( directory )
>   .setGoals( Arrays.asList( new String[]{ "package" } ) );
> embedder.execute( request );
> And this should work.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MNG-2722) Create a strategy for providing sane default values in the MavenExecutionRequest

Posted by "Aaron Digulla (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MNG-2722?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_86050 ] 

Aaron Digulla commented on MNG-2722:
------------------------------------

I've added a hack with the defaulsPopulator() to make localRepository work in MavenEmbedder:

         request = defaultsPopulator.populateDefaults( request );
+       request.setLocalRepository(getLocalRepository());
+       request.setLocalRepositoryPath(getLocalRepository().getBasedir());

This doesn't fix the NPE, though. After some more debugging, I've found this in the output after starting the embedder a second time:

[org.apache.maven:maven-plugin-tools-api:jar:2.0:runtime]
[ maven embedder DEBUG] Realm already exists for: org.apache.maven.plugins:maven-help-plugin. Skipping addition...

I guess this means that the embedder still has same garbage left from the last run so it won't load the plugin again even though it's now a different plugin (or, as in the test, the same plugin but from a different localRepository).

I see two solutions: Clean up the class realms when the embedder is started a second time (does that clear up static final variables?) or forbid to start it twice (as my patch does).

Just to prove my point, I've added a hack to start(MavenEmbedRequest):

classWorld = new ClassWorld( "plexus.core", classLoader );

With this code, it's possible to start the embedder twice but then, you either have to remove the constructors which pass in a ClassWorld or you must patch ClassWorld to support some kind of "reset()" method to clean up an existing realm.

> Create a strategy for providing sane default values in the MavenExecutionRequest
> --------------------------------------------------------------------------------
>
>                 Key: MNG-2722
>                 URL: http://jira.codehaus.org/browse/MNG-2722
>             Project: Maven 2
>          Issue Type: Task
>          Components: Embedding
>            Reporter: Jason van Zyl
>         Attachments: embedder-start-twice.patch
>
>
> Ideally an Embedder user should be able to do something like:
> MavenEmbedder embedder = new MavenEmbedder();
> MavenExecutionRequestion request = new DefaultMavenExecutionRequestion()
>   .setBasedir( directory )
>   .setGoals( Arrays.asList( new String[]{ "package" } ) );
> embedder.execute( request );
> And this should work.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira