【发布时间】:2016-04-23 16:27:09
【问题描述】:
我使用 maven 创建了一个 jar 文件并将其部署到本地工件。我可以在artifactory中看到jar文件和pom
<?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.mycompany.hr</groupId>
<artifactId>hotel-schema</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<parent>
<groupId>com.mycompany.hr</groupId>
<artifactId>spring-ws</artifactId>
<version>1</version>
</parent>
<name>jaxb-schema Spring-WS Application</name>
<url>http://www.springframework.org/spring-ws</url>
<build>
<finalName>hotel-schema</finalName>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>xjc</id>
<goals>
<goal>xjc</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- The package of your generated sources -->
<sources>
<source>../holidayService/src/main/xsd</source>
</sources>
<packageName>com.example.myschema</packageName>
<outputDirectory>target/generated-sources/jaxb</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>2.2</version>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>central</id>
<name>Babu-Dell-releases</name>
<url>http://localhost:8081/artifactory/local-maven-snapshots</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Babu-Dell-snapshots</name>
<url>http://localhost:8081/artifactory/local-maven-snapshots</url>
</snapshotRepository>
</distributionManagement>
</project>
但是,当我尝试将 jar 作为依赖项添加到另一个项目时,它没有被下载。我看不到任何错误。
<?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>com.mycompany.hr</groupId>
<artifactId>spring-ws</artifactId>
<version>1</version>
</parent>
<artifactId>holidayService</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>holidayService Spring-WS Application</name>
<url>http://www.springframework.org/spring-ws</url>
<repositories>
<repository>
<id>my-internal-site</id>
<url>http://localhost:8081/artifactory/local-maven-snapshots</url>
</repository>
</repositories>
<build>
<finalName>holidayService</finalName>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
<version>2.10</version>
</extension>
</extensions>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
<version>2.1.4.RELEASE</version>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>1.1.6</version>
</dependency>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>com.mycompany.hr</groupId>
<artifactId>hotel-schema</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>central</id>
<name>Babu-Dell-releases</name>
<url>http://localhost:8081/artifactory/local-maven-snapshots</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Babu-Dell-snapshots</name>
<url>http://localhost:8081/artifactory/local-maven-snapshots</url>
</snapshotRepository>
</distributionManagement>
</project>
请帮忙
请在我的本地存储库中找到附加的图像[本地存储库的图像][1]
也请在 settings.xml 下方找到
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<servers>
<server>
<username>admin</username>
<password>{YBoEnaZCnnEHquaMcfJGpTjh0I7i+vQAv9a2+CQL9ZE=}</password>
<id>central</id>
</server>
<server>
<username>admin</username>
<password>{YBoEnaZCnnEHquaMcfJGpTjh0I7i+vQAv9a2+CQL9ZE=}</password>
<id>snapshots</id>
</server>
</servers>
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>http://localhost:8081/artifactory/local-maven-snapshots</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot</name>
<url>http://localhost:8081/artifactory/local-maven-snapshots</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>http://localhost:8081/artifactory/plugins-release</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>plugins-snapshot</name>
<url>http://localhost:8081/artifactory/plugins-snapshot</url>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
</settings>
【问题讨论】:
-
你也可以分享错误吗?是未经授权的吗?没有找到?
-
我猜它已经在你的本地 repo
~/.m2/repository中了。特别是如果它是您部署它的同一台机器。 @Gangaraju:“我看不到任何错误。”。 -
是的,没有错误。我也可以在本地仓库中看到该文件。
-
我还添加了正在创建 jar 的本地存储库的图像,并且我还粘贴了我在 .m2 文件夹中的 settings.xml
-
你写“它没有被下载。”你为什么认为它应该被下载?它已经在你的本地仓库中了,为什么还要重新下载呢?如果您真的想再次下载它(例如,因为您第二次部署了相同的发布版本,出于显而易见的原因不鼓励这样做)请删除本地存储库中的相应文件夹。