You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Minto van der Sluis <mi...@multimach.com> on 2010/11/18 18:30:18 UTC

Different behaviour: Embedder versus command line

Hi folks,

I am trying to use the embedder on my project and run into different 
behaviour between embedder (class MavenCLI) and the maven command line.

The command that gets executed looks like:

     mvn -X -gs ...\maven.settings.xml -f ...\simple-pom.xml clean

Using the embedder with an empty local repo  results in the following error:

...
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.1 or one 
of its dependencies could not be resolved: Could not transfer artifact 
org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1 from central 
(http://repo1.maven.org/maven2): No connector available to access 
repository central (http://repo1.maven.org/maven2) of type default using 
the available factories -> [Help 1]
org.apache.maven.plugin.PluginResolutionException: Plugin 
org.apache.maven.plugins:maven-clean-plugin:2.4.1 or one of its 
dependencies could not be resolved: Could not transfer artifact 
org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1 from central 
(http://repo1.maven.org/maven2): No connector available to access 
repository central (http://repo1.maven.org/maven2) of type default using 
the available factories
...

Running the same command on the command line using Maven 3 works without 
problems. It populates the local repo as expected.

When running the embedder again on a populated local repo (populated by 
the previous command line run), it also works.

The pom being used here is extremely simple:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>simpletest</groupId>
<artifactId>test</artifactId>
<packaging>pom</packaging>
<version>1</version>
</project>

The settings.xml (maven.settings.xml) that I use contains the following:

<?xml version="1.0" encoding="UTF-8"?>

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 
http://maven.apache.org/xsd/settings-1.0.0.xsd">

<localRepository>target/maven.repo</localRepository>
<interactiveMode>false</interactiveMode>

<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<servers>
</servers>
<mirrors>
</mirrors>
<profiles>
</profiles>
</settings>


What am I missing or doing wrong? Where can I find more information on 
using Maven embedder?

Regards,

Minto

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Different behaviour: Embedder versus command line

Posted by Minto van der Sluis <mi...@multimach.com>.
Oliver thanks for the hint ;-)

Besides aether I also had to add the wagon http provider.

For people running into the same problem, add the following 2 
dependencies to the project depending the maven embedder.

<dependency>
<groupId>org.sonatype.aether</groupId>
<artifactId>aether-connector-wagon</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-http</artifactId>
<version>1.0-beta-6</version>
</dependency>

Regards,

Minto


Op 19-11-2010 10:15, Olivier Lamy schreef:
> Hi,
> What kind of dependencies do you have in your pom ?
> Have you added org.sonatype.aether:aether-connector-wagon:1.7 ?
> You can have a look here [1] to see a kind of embedder.
>
> HTH,


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Different behaviour: Embedder versus command line

Posted by Olivier Lamy <ol...@apache.org>.
Hi,
What kind of dependencies do you have in your pom ?
Have you added org.sonatype.aether:aether-connector-wagon:1.7 ?
You can have a look here [1] to see a kind of embedder.

HTH,
-- 
Olivier Lamy
http://twitter.com/olamy
http://www.linkedin.com/in/olamy

[1] https://hudson.dev.java.net/svn/hudson/trunk/hudson/lib/maven-embedder/


2010/11/18 Minto van der Sluis <mi...@multimach.com>:
> Hi folks,
>
> I am trying to use the embedder on my project and run into different
> behaviour between embedder (class MavenCLI) and the maven command line.
>
> The command that gets executed looks like:
>
>    mvn -X -gs ...\maven.settings.xml -f ...\simple-pom.xml clean
>
> Using the embedder with an empty local repo  results in the following error:
>
> ...
> [ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.1 or one of
> its dependencies could not be resolved: Could not transfer artifact
> org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1 from central
> (http://repo1.maven.org/maven2): No connector available to access repository
> central (http://repo1.maven.org/maven2) of type default using the available
> factories -> [Help 1]
> org.apache.maven.plugin.PluginResolutionException: Plugin
> org.apache.maven.plugins:maven-clean-plugin:2.4.1 or one of its dependencies
> could not be resolved: Could not transfer artifact
> org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1 from central
> (http://repo1.maven.org/maven2): No connector available to access repository
> central (http://repo1.maven.org/maven2) of type default using the available
> factories
> ...
>
> Running the same command on the command line using Maven 3 works without
> problems. It populates the local repo as expected.
>
> When running the embedder again on a populated local repo (populated by the
> previous command line run), it also works.
>
> The pom being used here is extremely simple:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd">
> <modelVersion>4.0.0</modelVersion>
> <groupId>simpletest</groupId>
> <artifactId>test</artifactId>
> <packaging>pom</packaging>
> <version>1</version>
> </project>
>
> The settings.xml (maven.settings.xml) that I use contains the following:
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
>                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>                  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
> http://maven.apache.org/xsd/settings-1.0.0.xsd">
>
> <localRepository>target/maven.repo</localRepository>
> <interactiveMode>false</interactiveMode>
>
> <pluginGroups>
> </pluginGroups>
> <proxies>
> </proxies>
> <servers>
> </servers>
> <mirrors>
> </mirrors>
> <profiles>
> </profiles>
> </settings>
>
>
> What am I missing or doing wrong? Where can I find more information on using
> Maven embedder?
>
> Regards,
>
> Minto
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org