2

我正在接管一个项目,一个 Android 应用程序,它是在 Eclipse 上使用 ADT 插件开发的。它还使用 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 的 IntellIJ 插件,但实际上,这是不合理的:)。

将 Maven 项目转换为 Gradle 应该相当简单,因为目录结构已经存在并且 Gradle 可以处理自定义 Maven 存储库

DexGuard 有很好的 Gradle 支持,我们在我的工作地点使用它,而且它很轻松。我的建议是将构建系统从 Maven 升级到 Gradle,并且永远不要回头。

于 2015-07-22T15:56:20.963 回答