【发布时间】:2017-03-20 18:01:13
【问题描述】:
我设置了一个 Eclipse Maven 项目以使用 GitHub 存储库作为依赖项。现在我分叉了那个存储库,将依赖项切换到了 fork,并对 fork 做了一个小的改动。现在该项目仍然可以正常编译和运行,但是 Eclipse 没有看到更改,这在 GitHub 上显示得很好。这让我想到:
如果 Eclipse 看不到对 GitHub 的依赖,它应该是无法构建项目的。另一方面,如果它可以在这里找到它但没有看到变化,那一定意味着新的分叉还没有以某种方式正确地链接到项目;很可能旧的 repo 仍然存在于我本地机器上的某个地方,Maven 使用它来构建项目,原因我无法辨别。我尝试重建并重新导入项目,但没有帮助。我是 Maven 的新手,所以我真的很迷茫。我需要知道:
这是什么原因造成的?我错过了 Maven/Eclipse/GitHub 的哪些工作方式?我需要下载、更新、刷新或重建什么文件或列表?
编辑; 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>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<executions>
<execution>
<id>l4j-clui</id>
<phase>package</phase>
<goals>
<goal>launch4j</goal>
</goals>
<configuration>
<dontWrapJar>true</dontWrapJar>
<headerType>console</headerType>
<jar>eet-demo-maven-1.0-SNAPSHOT.jar</jar>
<outfile>target\EETSender.exe</outfile>
<errTitle></errTitle>
<cmdLine></cmdLine>
<chdir>.</chdir>
<priority>normal</priority>
<downloadUrl>http://java.com/download</downloadUrl>
<supportUrl></supportUrl>
<stayAlive>true</stayAlive>
<restartOnCrash>true</restartOnCrash>
<manifest></manifest>
<icon></icon>
<singleInstance>
<mutexName>EETMutex</mutexName>
<windowTitle></windowTitle>
</singleInstance>
<classpath>
<mainClass>cz.tomasdvorak.eetdemo.Main</mainClass>
</classpath>
<jre>
<path></path>
<bundledJre64Bit>false</bundledJre64Bit>
<bundledJreAsFallback>false</bundledJreAsFallback>
<minVersion>1.6.0_1</minVersion>
<maxVersion></maxVersion>
<jdkPreference>preferJre</jdkPreference>
<runtimeBits>64/32</runtimeBits>
</jre>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>cz.tomasdvorak.eetdemo.Main</mainClass>
</manifest>
</archive>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
</configuration>
</plugin>
</plugins>
</build>
<groupId>cz.tomasdvorak</groupId>
<artifactId>eet-demo-maven</artifactId>
<version>1.0-SNAPSHOT</version>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.MiroslavMarecek</groupId>
<artifactId>eet-client-1</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.github.MiroslavMarecek</groupId>
<artifactId>eet-client-1</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
【问题讨论】:
-
您是否确实设置了依赖项?可以显示
pom.xml吗? -
你真的重建了你的“依赖”吗?比如
mvn clean install?如果没有,Maven 仍在使用本地 Maven 存储库中缓存的版本。 -
试过
mvn clean install,仍然没有看到变化。 -
@Sargon1 也尝试给你的补丁叉一个与原始版本不同的版本。