maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Connolly <stephen.alan.conno...@gmail.com>
Subject Re: Installing local dependency with the maven-install-plugin before the build
Date Mon, 08 Apr 2013 09:10:27 GMT
In order to ensure that the build plan is sequenced correctly, Maven needs
to map out the requirements of all the plugins that will be invoked as part
of the build plan.

If any of the plugins that are involved in the build plan indicate that
they require dependency resolution, then that means that there is a
possibility that the modules within the reactor on which those plugins will
execute may have dependencies within the reactor which could impact the
build plan.

Therefore Maven will try to resolve the dependencies of those modules
*before* the build starts in order to establish if the dependencies of that
module indirectly depend on artifacts within the reactor which would
therefore mandate a resequencing of the reactor build plan.

When you try the install:install-file hack, the very first time you run,
there is no way for Maven to resolve the dependency, and therefore Maven
says: "Hmmm, cannot find this at all, therefore the build will faile, and
fail fast is what we do... java.lang.System.exit(1)!"

The solutions you can choose are all rather similar to those I outline in
this blog post:
http://developer-blog.cloudbees.com/2013/03/playing-trade-offs-with-maven.html

HTH

-Stephen


On 8 April 2013 09:53, Eugen Paraschiv <hanriseldon@gmail.com> wrote:

> Hi,
> I am having a problem with the following scenario - I'm attempting to use
> the *maven-install-plugin* to install a jar in my local repository. I am
> binding the *install-file* goal to the *validate* phase (very early on), so
> that the jar would be installed before anything else, and so that the build
> process will have it available.
> However, that doesn't seem to work as expected - the dependency I'm trying
> to install is for some reason required even earlier, and so I get:
> *[ERROR] Failed to execute goal on project my-project: Could not resolve
> dependencies for project org:my-project:jar:0.16-SNAPSHOT: Could not find
> artifact org:new-dep:jar:0.16-SNAPSHOT in jboss-public-repository-group (
> https://repository.jboss.org/nexus/content/repositories/central/) -> [Help
> 1]*
> With debug mode on - it looks like the default plugins are executed, and
> the first thing they require is the full dependency tree to be OK:
> [ERROR] Failed to execute goal on project launchpad-touchdata-api: Could
> not resolve dependencies for project
> org:launchpad-touchdata-api:jar:0.16-SNAPSHOT: The repository system is
> offline but the artifact org:launchpad-security-api:jar:0.16-SNAPSHOT is
> not available in the local repository. -> [Help 1]
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute
> goal on project launchpad-touchdata-api: Could not resolve dependencies for
> project org:launchpad-touchdata-api:jar:0.16-SNAPSHOT: The repository
> system is offline but the artifact
> org:launchpad-security-api:jar:0.16-SNAPSHOT is not available in the local
> repository.
>     at
>
> org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:210)
>     at
>
> org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:117)
>     at
>
> org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:258)
>     at
>
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:201)
>     at
>
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
>     at
>
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
>     at
>
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
>     at
>
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
>     at
>
> org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
>     at
>
> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
>     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
>     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
>     at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
>     at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
>     at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>     at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>     at java.lang.reflect.Method.invoke(Method.java:601)
>     at
>
> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
>     at
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
>     at
>
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
>     at
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
>
> Is that correct? If so, is there no way to use maven-install-plugin to
> install the local dependency before the build will actually require the
> dependency?
> I will mention that, if the jar is installed like this, but it's not
> required by this project directly as a dependency - it gets installed just
> fine.
> Any help is appreciated.
> Thanks.
> Eugen.
>
> --
> Eugen Paraschiv
> Senior Java Programmer, Optaros
> Mobile: +40728896170
> Blog: www.baeldung.com
> Twitter: https://twitter.com/baeldung
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message