2

ADT プラグインを使用して Eclipse で開発された Android アプリのプロジェクトを引き継いでいます。また、maven3 と dexguard を使用してコードを難読化します。

私は通常 Android Studio (AS) で作業しているので、古いプロジェクトを AS にインポートしました。Dexguard 以外はすべて正常に動作します。

プロジェクトを実行したいときはいつでも、次のようなエラーが表示されます。No implementation for org.eclipse.aether.impl.VersionResolver was bound.

完全なエラー メッセージは次のとおりです。

[ERROR] Failed to execute goal com.saikoa.dexguard.maven:dexguard-maven-plugin:5.5.32:generate-sources (default-generate-sources) on project app-android-genmsecure: Execution default-generate-sources of goal com.saikoa.dexguard.maven:dexguard-maven-plugin:5.5.32:generate-sources failed: Unable to load the mojo 'generate-sources' (or one of its required components) from the plugin 'com.saikoa.dexguard.maven:dexguard-maven-plugin:5.5.32': com.google.inject.ProvisionException: Guice provision errors:
[ERROR] 
[ERROR] 1) No implementation for org.eclipse.aether.impl.VersionResolver was bound.
[ERROR] while locating org.eclipse.aether.internal.impl.DefaultRepositorySystem
[ERROR] at ClassRealm[plugin>com.saikoa.dexguard.maven:dexguard-maven-plugin:5.5.32, parent: sun.misc.Launcher$AppClassLoader@1efde7ba]
[ERROR] at ClassRealm[plugin>com.saikoa.dexguard.maven:dexguard-maven-plugin:5.5.32, parent: sun.misc.Launcher$AppClassLoader@1efde7ba]
[ERROR] while locating org.eclipse.aether.RepositorySystem
[ERROR] while locating com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo
[ERROR] at ClassRealm[plugin>com.saikoa.dexguard.maven:dexguard-maven-plugin:5.5.32, parent: sun.misc.Launcher$AppClassLoader@1efde7ba]
[ERROR] while locating org.apache.maven.plugin.Mojo annotated with @com.google.inject.name.Named(value=com.saikoa.dexguard.maven:dexguard-maven-plugin:5.5.32:generate-sources)
[ERROR] 
[ERROR] 1 error
[ERROR] role: org.apache.maven.plugin.Mojo
[ERROR] roleHint: com.saikoa.dexguard.maven:dexguard-maven-plugin:5.5.32:generate-sources
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.saikoa.dexguard.maven:dexguard-maven-plugin:5.5.32:generate-sources (default-generate-sources) on project app-android-genmsecure: Execution default-generate-sources of goal com.saikoa.dexguard.maven:dexguard-maven-plugin:5.5.32:generate-sources failed: Unable to load the mojo 'generate-sources' (or one of its required components) from the plugin 'com.saikoa.dexguard.maven:dexguard-maven-plugin:5.5.32'
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225)
    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:606)
    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)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-generate-sources of goal com.saikoa.dexguard.maven:dexguard-maven-plugin:5.5.32:generate-sources failed: Unable to load the mojo 'generate-sources' (or one of its required components) from the plugin 'com.saikoa.dexguard.maven:dexguard-maven-plugin:5.5.32'
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:115)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 20 more
Caused by: org.apache.maven.plugin.PluginContainerException: Unable to load the mojo 'generate-sources' (or one of its required components) from the plugin 'com.saikoa.dexguard.maven:dexguard-maven-plugin:5.5.32'
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:488)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:92)
    ... 21 more
Caused by: org.codehaus.plexus.component.repository.exception.ComponentLookupException: com.google.inject.ProvisionException: Guice provision errors:

1) No implementation for org.eclipse.aether.impl.VersionResolver was bound.
  while locating org.eclipse.aether.internal.impl.DefaultRepositorySystem
  at ClassRealm[plugin>com.saikoa.dexguard.maven:dexguard-maven-plugin:5.5.32, parent: sun.misc.Launcher$AppClassLoader@1efde7ba]
  at ClassRealm[plugin>com.saikoa.dexguard.maven:dexguard-maven-plugin:5.5.32, parent: sun.misc.Launcher$AppClassLoader@1efde7ba]
  while locating org.eclipse.aether.RepositorySystem
  while locating com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo
  at ClassRealm[plugin>com.saikoa.dexguard.maven:dexguard-maven-plugin:5.5.32, parent: sun.misc.Launcher$AppClassLoader@1efde7ba]
  while locating org.apache.maven.plugin.Mojo annotated with @com.google.inject.name.Named(value=com.saikoa.dexguard.maven:dexguard-maven-plugin:5.5.32:generate-sources)

1 error
      role: org.apache.maven.plugin.Mojo
  roleHint: com.saikoa.dexguard.maven:dexguard-maven-plugin:5.5.32:generate-sources
    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:257)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:245)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:455)
    ... 22 more
Caused by: com.google.inject.ProvisionException: Guice provision errors:

1) No implementation for org.eclipse.aether.impl.VersionResolver was bound.
  while locating org.eclipse.aether.internal.impl.DefaultRepositorySystem
  at ClassRealm[plugin>com.saikoa.dexguard.maven:dexguard-maven-plugin:5.5.32, parent: sun.misc.Launcher$AppClassLoader@1efde7ba]
  at ClassRealm[plugin>com.saikoa.dexguard.maven:dexguard-maven-plugin:5.5.32, parent: sun.misc.Launcher$AppClassLoader@1efde7ba]
  while locating org.eclipse.aether.RepositorySystem
  while locating com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo
  at ClassRealm[plugin>com.saikoa.dexguard.maven:dexguard-maven-plugin:5.5.32, parent: sun.misc.Launcher$AppClassLoader@1efde7ba]
  while locating org.apache.maven.plugin.Mojo annotated with @com.google.inject.name.Named(value=com.saikoa.dexguard.maven:dexguard-maven-plugin:5.5.32:generate-sources)

1 error
    at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:974)
    at com.google.inject.Scopes$1$1.get(Scopes.java:59)
    at org.sonatype.guice.bean.locators.LazyBeanEntry.getValue(LazyBeanEntry.java:83)
    at org.sonatype.guice.plexus.locators.LazyPlexusBean.getValue(LazyPlexusBean.java:49)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:253)
    ... 24 more
[ERROR]  

そして pom.xml ファイル:

<?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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>[HIDDEN]</groupId>
    <artifactId>[HIDDEN]</artifactId>
    <version>1.9.0-SNAPSHOT</version>
    <packaging>apk</packaging>
    <name>[HIDDEN]</name>

    <!-- SCM tag for maven releases -->
    <scm>
        <connection>[HIDDEN]</connection>
      <tag>HEAD</tag>
  </scm>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!-- Android -->
        <android.sdk.path>${env.ANDROID_HOME}</android.sdk.path>
        <android.sdk.platform>17</android.sdk.platform>
    </properties>

    <distributionManagement>
        <!-- Maven Repository to deploy artifact : Nexus -->
        <repository>
            <id>releases</id>
            <name>Internal Releases</name>
            <url>[HIDDEN]</url>
        </repository>
        <snapshotRepository>
            <id>snapshots</id>
            <name>Internal Snapshots</name>
            <url>[HIDDEN]</url>
        </snapshotRepository>
    </distributionManagement>

    <dependencies>
        <!-- Android dependencies -->
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android</artifactId>
            <version>4.1.1.4</version>
            <scope>provided</scope>
        </dependency>

        <!-- External dependencies -->
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.2.2</version>
        </dependency>

        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.5</version>
        </dependency>
    </dependencies>

    <build>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.saikoa.dexguard.maven</groupId>
                    <artifactId>dexguard-maven-plugin</artifactId>
                    <version>5.5.32</version>
                    <extensions>true</extensions>
                </plugin>
                <!-- <plugin> -->
                <!-- <groupId>com.jayway.maven.plugins.android.generation2</groupId> -->
                <!-- <artifactId>android-maven-plugin</artifactId> -->
                <!-- <version>3.8.0</version> -->
                <!-- </plugin> -->
            </plugins>
        </pluginManagement>

        <finalName>${project.artifactId}</finalName>
        <plugins>
            <plugin>
                <groupId>com.saikoa.dexguard.maven</groupId>
                <artifactId>dexguard-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <dexguardConfig>dexguard-project-debug.txt</dexguardConfig>
                    <release>false</release>
                </configuration>
            </plugin>

            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.4.3</version>
                <configuration>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.7</version>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>src/main/java</source>
                                <source>src/main/native</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5</version>
                        <configuration>
                            <!-- During release:perform, enable the "release" profile -->
                            <releaseProfiles>release</releaseProfiles>
                        </configuration>
            </plugin>
             <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                 <version>2.10.3</version>
                <configuration>
                    <failOnError>false</failOnError>
                </configuration>
            </plugin>

        </plugins>
    </build>

    <profiles>
        <profile>
            <!-- Profile release : will be activated during release. Will obfuscate and process the code -->
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.saikoa.dexguard.maven</groupId>
                        <artifactId>dexguard-maven-plugin</artifactId>
                        <extensions>true</extensions>
                        <configuration>
                            <release>true</release>
                            <dexguardConfig>dexguard-project-release.txt</dexguardConfig>
                        </configuration>
                    </plugin>

                </plugins>
            </build>
        </profile>
        <profile>
            <!-- Customer profile, to rename the package name. -->
            <id>ncr</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.saikoa.dexguard.maven</groupId>
                        <artifactId>dexguard-maven-plugin</artifactId>
                        <configuration>
                            <renameManifestPackage>[HIDDEN]</renameManifestPackage>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <!-- Customer profile, to rename the package name. -->
            <id>[HIDDEN]</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.saikoa.dexguard.maven</groupId>
                        <artifactId>dexguard-maven-plugin</artifactId>
                        <configuration>
                            <renameManifestPackage>[HIDDEN]</renameManifestPackage>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>

他に何か必要があれば教えてください。

ご協力いただきありがとうございます。

4

1 に答える 1

1

Aetherは、Eclipse 内で Maven リポジトリーを操作するための Eclipse ライブラリーです。このシステムが Android Studio で利用できないのは理にかなっていると思います。私はその差し迫った問題の解決策を持っていません。Aether を公開する IntelIJ プラグインを作成することは可能かもしれないと思いますが、実際には、それは非常に不合理です :)。

Maven プロジェクトの Gradle への変換は、ディレクトリ構造が既に存在し、Gradle がカスタム Maven リポジトリを処理できるため、かなり簡単です。

DexGuard は Gradle を適切にサポートしており、職場で使用していますが、簡単に使用できます。私のアドバイスは、ビルド システムを Maven から Gradle にアップグレードすることです。

于 2015-07-22T15:56:20.963 に答える