我已经设置了一个 Eclipse Maven 项目来使用 GitHub 存储库作为依赖项。现在,我 fork 了该存储库,将依赖关系切换到 fork ,并对 fork 进行了一些小更改。现在该项目仍然可以正常编译和运行,但 Eclipse 没有看到更改,这在 GitHub 上显示得很好。这让我想到:
如果 Eclipse 无法看到对 GitHub 的依赖关系,它应该无法构建该项目。另一方面,如果它可以在某个地方获取它但没有看到变化,则一定意味着新的 fork 尚未以某种方式正确链接到项目;很可能旧的存储库仍然位于我本地计算机上的某个位置,并且出于我无法辨别的原因,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>
最佳答案
jar 版本是否已更改?如果没有,该 jar 可能缓存在您的本地 Maven 存储库中。 C:\Users\用户名\.m2
查看此线程了解详细信息:How do I remove a cached local artifact that maven fetched?
关于java - Eclipse 看不到 Maven 项目的 GitHub 依赖项中所做的更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40464405/