1

我已经建立了我的内部关系存储库。现在我已经更改了我的 settings.xml 文件以指向我的存储库,但我也想在我的项目 pom.xml 文件中包含引用。现在这个 pom.xml 文件有效吗?如果我更改了 repo 的密码,maven 仍然从 repo 下载文件吗?我究竟做错了什么 ?这个配置正确吗?

<?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>
    <groupId>com.mycomp</groupId>
    <artifactId>TestAndroid</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>apk</packaging>
    <name>Test Android Application</name>
    <servers>
        <server>
            <id>com-repo</id>
            <username>admin</username>
            <password>admin</password>
        </server>
    </servers>
    <repositories>
        <repository>
            <id>com-repo</id>
            <url>http://central</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>com-repo</id>
            <name>com-repo</name>
            <url>http://10.10.10.230:8081/nexus/content/groups/public/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>
    <dependencies>
        <dependency>
            <groupId>org.springframework.android</groupId>
            <artifactId>spring-android-rest-template</artifactId>
            <version>1.0.1.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-mapper-asl</artifactId>
            <version>1.9.8</version>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>20030203.000129</version>
        </dependency>
        <dependency>
            <groupId>com.actionbarsherlock</groupId>
            <artifactId>actionbarsherlock</artifactId>
            <version>4.2.0</version>
            <type>apklib</type>
        </dependency>

        <dependency>
            <groupId>org.google</groupId>
            <artifactId>admob</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.mycpmp</groupId>
            <artifactId>1234</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.test</groupId>
            <artifactId>test</artifactId>
            <version>1.0.0</version>
        </dependency>

        <dependency>
            <groupId>org.taptwo.android</groupId>
            <artifactId>widget</artifactId>
            <version>1.0.0</version>
            <type>apklib</type>
        </dependency>
        <dependency>
            <groupId>commons-validator</groupId>
            <artifactId>commons-validator</artifactId>
            <version>1.4.0</version>
        </dependency>

        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android</artifactId>
            <version>4.1.1.4</version>
            <scope>provided</scope>
        </dependency>
        <!-- <dependency> -->
        <!-- <groupId>com.google.api-ads</groupId> -->
        <!-- <artifactId>dfp-lib</artifactId> -->
        <!-- <version>0.4.0</version> -->
        <!-- </dependency> -->


    </dependencies>
    <build>
        <finalName>${project.artifactId}</finalName>
        <sourceDirectory>src/main/java</sourceDirectory>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                    <artifactId>android-maven-plugin</artifactId>
                    <version>3.1.1</version>
                    <extensions>true</extensions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <configuration>
                    <attachSources>true</attachSources>
                    <sign>
                        <debug>false</debug>
                    </sign>
                    <sdk>
                        <platform>16</platform>
                    </sdk>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jarsigner-plugin</artifactId>
                <version>1.2</version>
                <executions>
                    <execution>
                        <id>signing</id>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                        <phase>package</phase>
                        <inherited>true</inherited>
                        <configuration>
                            <archiveDirectory></archiveDirectory>
                            <includes>
                                <include>target/*.apk</include>
                            </includes>
                            <keystore>avm.keystore</keystore>
                            <storepass>123</storepass>
                            <keypass>123</keypass>
                            <alias>asdfg</alias>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project> 
4

2 回答 2

0

你的 pom 无效。如此处所述,您不应将用户名和密码放在 pom.xml 中。

用于下载和部署的存储库由 POM 的存储库和 distributionManagement 元素定义。但是,某些设置(例如用户名和密码)不应与 pom.xml 一起分发。此类信息应存在于构建服务器的 settings.xml 中。

于 2013-01-17T14:45:42.390 回答
0

凭据仅用于部署到存储库。用于部署的存储库在distributionManagement元素中定义;它与存储库元素的东西不同。repositories 元素定义了从其中解析依赖项的 repos。

此外,pom 不支持像这样放入凭据。执行时是否出现错误?我会这么认为。

于 2013-01-16T18:48:07.587 回答