On 1 Jun 2011, at 17:19, pnmpn wrote:

> I'm trying to upgrade my struts2 web app from guice2.0 to guice3.0.
> I'm trying to test it out using maven jetty. I've successfully
> upgraded my pom.xml to use the correct version and groupId for the 3.0
> release, but if I call mvn jetty:run I see that it is trying to
> download guice-3.0-no_deps.jar
> 
> which throws a build error and can't be found the central repository?

The guice-3.0-no_deps.jar is a build-time artifact that's used to compile the 
extensions, but is not required at runtime - it's not on maven central because 
the Guice team didn't want people depending on this "uber-jar" by mistake. The 
extensions have an optional dependency to guice-3.0-no_deps.jar (so they can 
compile) but they also have a non-optional dependency to guice-3.0.jar for the 
runtime case.

Well-behaved maven plugins should see that the the no_deps dependency is 
optional and not throw a build error if it's missing, so this sounds like a bug 
in the jetty plugin. To workaround the Jetty bug you can explicitly hide this 
dependency as follows:

        <dependency>
            <groupId>com.google.inject.extensions</groupId>
            <artifactId>guice-struts2</artifactId>
            <version>3.0</version>
            <exclusions>
                <exclusion>
                    <groupId>com.google.inject</groupId>
                    <artifactId>guice</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.google.inject</groupId>
            <artifactId>guice</artifactId>
            <version>3.0</version>
        </dependency>

Note that we can't do this in the original build pom because we still need the 
no_deps dependency when doing the original compilation.

> I don't get this error if I don't include any guice extensions such
> as
> 
>        <dependency>
>            <groupId>com.google.inject.extensions</groupId>
>            <artifactId>guice-struts2</artifactId>
>            <version>3.0</version>
>        </dependency>
> 
> 
> Any ideas?
> 
> Thanks
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "google-guice" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/google-guice?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to