从Unable to build maven project, pom.xml file not found开始,我发现如果settings.xml存在,则项目无法构建。但是我需要settings.xml来告诉maven如何找到Oracle ojdbc6.jar文件。
的settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>build_server</id>
<username>admin</username>
<password>password</password>
</server>
</servers>
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>http://build_server:8081/artifactory/libs-release</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot</name>
<url>http://build_server:8081/artifactory/libs-snapshot</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>http://build_server:8081/artifactory/plugins-release</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>plugins-snapshot</name>
<url>http://build_server:8081/artifactory/plugins-snapshot</url>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
</settings>
pom.xml非常大(649行),但是如果上面的settings.xml不存在,那么项目会构建但是单元测试失败,因为它无法连接到Oracle DB。如果上面的settings.xml文件确实存在,那么它可以在Artifactory中找到如果settings.xml不存在就找到它的工件。
reposiories和分销管理部分是:
<repositories>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>http://build_server:8081/artifactory/libs-release</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot</name>
<url>http://build_server:8081/artifactory/libs-snapshot</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>http://build_server:8081/artifactory/plugins-release</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>plugins-snapshot</name>
<url>http://build_server:8081/artifactory/plugins-snapshot</url>
</pluginRepository>
<pluginRepository>
<id>maven.oracle.com</id>
<name>oracle-maven-repo</name>
<url>https://maven.oracle.com</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>
<distributionManagement>
<repository>
<id>build_server</id>
<name>build_server-releases</name>
<url>http://build_server:8081/artifactory/libs-release-local</url>
</repository>
<snapshotRepository>
<id>build_server</id>
<name>build_server-snapshots</name>
<url>http://build_server:8081/artifactory/libs-snapshot-local</url>
</snapshotRepository>
</distributionManagement>
我非常困惑,希望得到一些指导。
build_server(不是它的真名)在端口8081上运行artifactory,在8111上运行teamcity。
由于
答案 0 :(得分:0)
好的,所以问题原来就是ID了。我更改了distributionManagement部分的pom.xml中的ID,以匹配pluginRepositories部分中的ID,现在它可以正常工作。
我希望这有助于其他人。