4

Guice 3.0 の ivy ファイルには、guice-3.0-no_aop.jar. 私は Android アプリケーションを作成しているので、guice-3.0.jar.

<ivy-module version="1.0">
    <info organisation="com.myapp.android" module="appname"/>
    <dependencies>
        <!-- other dependencies -->
        <dependency org="org.roboguice" name="roboguice" rev="2.0"
          transitive="false" />
        <dependency org="com.google.inject" name="guice" rev="3.0"
          transitive="false">
            <artifact name="guice-3.0-no_aop" type="jar" />
        </dependency>
    </dependencies>
</ivy-module>

上記の構成とその派生物を使用すると、次のようなエラーが表示されます。

Some projects fail to be resolved
 Impossible to resolve dependencies of com.mystuff.android#myapp;working@computer
  download failed: com.google.inject#guice;3.0!guice-3.0-no_aop.jar

構成の何が問題になっていますか? を使用するには、依存関係をどのように構成すればよい
guice-3.0-no_aop.jarですか?

編集
明確にするために、Guice 3.0 を最も簡単な方法で構成しようとしました。

<dependency org="com.google.inject" name="guice" rev="3.0"
              transitive="false">

残念ながら、これはツタを使用するだけの結果になりguice-3.0.jarます。ダウンロードされたが使用されていない を使用するように構成する必要がありますguice-3.0-no_aop.jar

編集
ここで要求されたのは、Guice 3.0 の ivy.xml の内容です。

<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
    <info organisation="com.google.inject"
        module="guice"
        revision="3.0"
        status="release"
        publication="20110325121947"
    >
        <description homepage="" />
        <m:properties__guice.with.no_aop>true</m:properties__guice.with.no_aop>
        <m:properties__project.build.sourceEncoding>UTF-8</m:properties__project.build.sourceEncoding>
        <m:properties__guice.api.version>1.3</m:properties__guice.api.version>
        <m:properties__cglib.version>2.2.1-v20090111</m:properties__cglib.version>
        <m:properties__guice.with.jarjar>true</m:properties__guice.with.jarjar>
        <m:maven.plugins>null__maven-remote-resources-plugin__null|org.codehaus.mojo__animal-sniffer-maven-plugin__null|null__maven-surefire-plugin__null|org.apache.felix__maven-bundle-plugin__null|null__maven-jar-plugin__null</m:maven.plugins>
    </info>
    <configurations>
        <conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf" extends="runtime,master"/>
        <conf name="master" visibility="public" description="contains only the artifact published by this module itself, with no transitive dependencies"/>
        <conf name="compile" visibility="public" description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths."/>
        <conf name="provided" visibility="public" description="this is much like compile, but indicates you expect the JDK or a container to provide it. It is only available on the compilation classpath, and is not transitive."/>
        <conf name="runtime" visibility="public" description="this scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath." extends="compile"/>
        <conf name="test" visibility="private" description="this scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases." extends="runtime"/>
        <conf name="system" visibility="public" description="this scope is similar to provided except that you have to provide the JAR which contains it explicitly. The artifact is always available and is not looked up in a repository."/>
        <conf name="sources" visibility="public" description="this configuration contains the source artifact of this module, if any."/>
        <conf name="javadoc" visibility="public" description="this configuration contains the javadoc artifact of this module, if any."/>
        <conf name="optional" visibility="public" description="contains all optional dependencies"/>
    </configurations>
    <publications>
        <artifact name="guice" type="jar" ext="jar" conf="master"/>
        <artifact name="guice" type="source" ext="jar" conf="sources" m:classifier="sources"/>
        <artifact name="guice" type="javadoc" ext="jar" conf="javadoc" m:classifier="javadoc"/>
    </publications>
    <dependencies>
        <dependency org="javax.inject" name="javax.inject" rev="1" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
        <dependency org="aopalliance" name="aopalliance" rev="1.0" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
        <dependency org="org.sonatype.sisu.inject" name="cglib" rev="2.2.1-v20090111" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
        <dependency org="javax.inject" name="javax.inject-tck" rev="1" force="true" conf="test->runtime(*),master(*)"/>
        <dependency org="org.springframework" name="spring-beans" rev="3.0.5.RELEASE" force="true" conf="test->runtime(*),master(*)"/>
        <dependency org="biz.aQute" name="bnd" rev="0.0.384" force="true" conf="test->runtime(*),master(*)"/>
        <dependency org="org.apache.felix" name="org.apache.felix.framework" rev="3.0.5" force="true" conf="test->runtime(*),master(*)"/>
        <dependency org="org.testng" name="testng" rev="5.11" force="true" conf="test->runtime(*),master(*)">
            <artifact name="testng" type="jar" ext="jar" conf="" m:classifier="jdk15"/>
        </dependency>
    </dependencies>
</ivy-module>
4

2 に答える 2

1

アイビーファイルにはいくつかのmavenプロパティが含まれているようで、次のように書かれています:

<m:properties__guice.with.no_aop>true</m:properties__guice.with.no_aop>

したがって、このアーティファクトにはすでに aop がありません。

したがって、次を省略できます。

<artifact name="guice-3.0-no_aop" type="jar" />

次のように推測を解決します。

<dependency org="com.google.inject" name="guice" rev="3.0"
          transitive="false"/>
于 2012-08-27T06:30:27.130 に答える
1

多くの投稿をハッキングし、多くの試行錯誤を繰り返した結果、次のように機能するようになりました。

<dependency org="com.google.inject" name="guice" rev="3.0">
   <artifact name="guice"  m:classifier="no_aop" type="jar" />
</dependency>

ダウンロードしたファイルのサイズをチェックして、AOP を使用してデフォルトの jar よりも小さいことを確認できます。また、取得パターンを変更して、オプションの分類子属性を含めることができるため、ファイル名の変更を確認できます。

<ivy:retrieve 
    pattern="lib/[artifact]-[revision](-[classifier]).[ext]" />

関連する SO の質問Ivy で異なる分類子を使用して複数の Maven 依存関係をダウンロードする方法は?

これもうまくいくかもしれません: http://mail-archives.apache.org/mod_mbox/ant-ivy-user/200905.mbox/%3CCAD31248BE809F4A869854C597A558EE0AC62344@TROUX-EX01.hq.troux.com%3E

于 2012-10-19T00:33:13.063 に答える