gpt4 book ai didi

android - Maven:无法解析 pom.xml 中的属性

转载 作者:行者123 更新时间:2023-11-29 21:46:30 26 4
gpt4 key购买 nike

我刚刚开始将我的 Android 项目转换为 Maven。
我试图在我的 pom.xml 中使用 properties 但我收到错误:

Dependency com.google.android:android${android.version} not found

${junit.version} 外,其他属性也出现相同的错误。
下面是我的 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>

<groupId>com.myproject.app</groupId>
<artifactId>parent</artifactId>
<packaging>pom</packaging>
<version>1.0</version>

<modules>
<module>myapp</module>
<module>mytests</module>
</modules>

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

<java.version>1.6</java.version>
<abs.version>4.2.0</abs.version>
<noa.version>2.4.0</noa.version>
<junit.version>4.8.1</junit.version>
<android.version>4.1.1.4</android.version>
<android-support.version>r12</android-support.version>
<android.sdk.platform>16</android.sdk.platform>
</properties>


<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>${android.version}</version>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>support-v4</artifactId>
<version>${android-support.version}</version>
</dependency>
<dependency>
<groupId>com.nineoldandroids</groupId>
<artifactId>library</artifactId>
<version>${noa.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>

<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.3.2</version>
<configuration>
<sdk>
<platform>${android.platform}</platform>
</sdk>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<failsOnError>true</failsOnError>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</pluginManagement>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.2.2</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>

<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.5</version>
<executions>
<execution>
<phase>site</phase>
<goals>
<goal>site</goal>
</goals>
</execution>
</executions>
<configuration>
<message>Creating site for ${project.version}.</message>
<outputDirectory>website</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>

最佳答案

它获取了对我来说很好的依赖项。我建议检查几件事:

  • 运行 mvn -X compile 以获取有关正在使用哪些镜像的更多信息
  • 检查您的 maven settings.xml 以查看您使用的是哪些镜像
  • 验证没有防火墙阻止对存储库的访问

关于android - Maven:无法解析 pom.xml 中的属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15666251/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com