Java Can';无法让库Maven依赖项显示
我从朱诺Eclipse切换到开普勒,并导入了我的Maven项目。然而,“Maven依赖项”并没有显示在项目属性Java构建路径库下,因此我无法编译我的项目。在Maven Repositories视图中,我可以看到本地存储库下的所有依赖项jar文件。我可以手动添加外部Jar文件,但必须有一种正确的方法来动态加载它们。我可以从Eclipse成功运行“maven安装”。我已经尝试过这个论坛的所有建议,比如运行Maven更新项目、取消选中Maven解析工作区项目的依赖项、窗口首选项检查“启动时下载存储库索引更新”和“启动时更新Maven项目”。开普勒日食有些奇怪。我错过了什么 这是我的pom.xml http://maven.apache.org/xsd/maven-4.0.0.xsd“>Java Can';无法让库Maven依赖项显示,java,eclipse,maven,m2eclipse,eclipse-kepler,Java,Eclipse,Maven,M2eclipse,Eclipse Kepler,我从朱诺Eclipse切换到开普勒,并导入了我的Maven项目。然而,“Maven依赖项”并没有显示在项目属性Java构建路径库下,因此我无法编译我的项目。在Maven Repositories视图中,我可以看到本地存储库下的所有依赖项jar文件。我可以手动添加外部Jar文件,但必须有一种正确的方法来动态加载它们。我可以从Eclipse成功运行“maven安装”。我已经尝试过这个论坛的所有建议,比如运行Maven更新项目、取消选中Maven解析工作区项目的依赖项、窗口首选项检查“启动时下载存储库
4.0.0
com.xxx.xxx
活性
3.1.0
聚甲醛
org.apache.maven.plugins
maven编译器插件
3.1
1.6
1.6
org.codehaus.mojo
声纳maven插件
2
org.apache.maven.plugins
maven surefire插件
2.17
真的
maven汇编插件
2.4
包裹
单一的
带有依赖项的jar
com.xxx.xxx.xxx.xxx.xxx
src/main/assembly/bin.xml
带有依赖项的jar
org.apache.maven.wagen
马车ssh
2.3
.
http://xxx.xxx.local/mave
http://xxx.xxx.local/xxx/releases
http://xxx.associatesys.local/xxx/snapshots
scp://xxx.associatesys.local/../../../srv/www/release/xxxx/releases
scp://xxx.xxx.local/../../../srv/www/release/xxx/snapshots
UTF-8
中心的
中心的
http://repo1.maven.org/maven2
假的
xxx中心
XXX中心
http://xxx.xxx.local/maven2/central
假的
xxx发布
内释药
${xxx.releases}
假的
xxx发布
XXXReleases存储库
${xxx.releases}
假的
xxx快照
XXXX快照存储库
${xxx.snapshots}
真的
间隔时间:30
log4j
log4j
1.2.16
sqljdbc
sqljdbc
4.
xxxx
xxx xxx
1.0.0
com.xxx.xxx.client
xxx客户
1.0.0
com.xxx.xxx.xxx
xxx xxx
1.0.0
com.xxx.xxx.common
xxx普通
1.0.0
xxx发布
XXXXReleases存储库
${xxx.releases.distribution}
xxx快照
XXXSnapshots存储库
${xxx.snapshots.distribution}
更新:我通过复制和粘贴Eclipse(开普勒)中另一个Maven项目的.classpath和.project文件解决了这个问题我对这两个文件做了一些小的调整。我比较了pom.xml文件,没有发现任何不一致的地方会阻止Eclipse创建我的Maven项目。这不是一个理想的解决方案,但目前它仍然有效,没有时间解决Eclipse的“谜”“。感谢下面的评论,他们为我指明了正确的方向,帮助我更好地理解问题 您是否在新的工作区中使用了Import->existingmaven项目?m2e尊重当前的Eclipse元文件。如果在没有Eclipse元文件的情况下无法从版本控制系统中创建新签出,则在尝试再次导入之前,应手动从当前项目中删除.settings、.project和.classsomething。谢谢。我删除了我的项目,删除了.settings、.project、.classpath,并再次导入了一个项目。它看起来不一样,缺少项目名称图标上的小“J”。它看起来更像一个库,而不是一个开发项目。对于版本控制,我使用Clear Case。我已经签出了这个项目,只想添加到Eclipse中进行进一步的开发。我不想做“创建Maven项目”,因为我已经有了列出了所有依赖项的pom.xml。然后你的pom.xml被破坏了。可能。我刚开始使用maven,没有经验。尽管我可以用这个pom.xml构建我的项目。我在上面添加了pom.xml内容。请给我一些修改的想法。
<modelVersion>4.0.0</modelVersion>
<groupId>com.xxx.xxx</groupId>
<artifactId>actives</artifactId>
<version>3.1.0</version>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<id>jar-with-dependencies</id>
</execution>
</executions>
<configuration>
<archive>
<manifest>
<mainClass>com.xxx.xxx.xxx.xxx.XXX</mainClass>
</manifest>
</archive>
<descriptors>
<descriptor>src/main/assembly/bin.xml</descriptor>
</descriptors>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef> <!-- Include all depedencies in build -->
</descriptorRefs>
<!--<appendAssemblyId>false</appendAssemblyId> -->
</configuration>
</plugin>
</plugins>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>2.3</version>
</extension>
</extensions>
</build>
<properties>
<root>.</root>
<xxx.releases>http://xxx.xxx.local/mave</xxx.releases>
<xxxx.releases>http://xxx.xxx.local/xxx/releases</xxx.releases>
<xxx.snapshots>http://xxx.associatesys.local/xxx/snapshots</xxx.snapshots>
<xxx.releases.distribution>scp://xxx.associatesys.local/../../../srv/www/release/xxxx/releases</xxx.releases.distribution>
<xxx.snapshots.distribution>scp://xxx.xxx.local/../../../srv/www/release/xxx/snapshots</xxx.snapshots.distribution>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>central</id>
<name>central</name>
<url>http://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>xxx-central</id>
<name>XXXCentral</name>
<url>http://xxx.xxx.local/maven2/central</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>xxx-releases</id>
<name>Internal ReleasesRepository</name>
<url>${xxx.releases}</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>xxx-releases</id>
<name>XXXReleases Repository</name>
<url>${xxx.releases}</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>xxx-snapshots</id>
<name>XXXX Snapshots Repository</name>
<url>${xxx.snapshots}</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>interval:30</updatePolicy>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<dependency>
<groupId>sqljdbc</groupId>
<artifactId>sqljdbc</artifactId>
<version>4</version>
</dependency>
<dependency>
<groupId>xxxx</groupId>
<artifactId>xxx-xxx</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.xxx.xxx.client</groupId>
<artifactId>xxx-client</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.xxx.xxx.xxx</groupId>
<artifactId>xxx-xxx</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.xxx.xxx.common</groupId>
<artifactId>xxx-common</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>xxx-releases</id>
<name>XXXXReleases Repository</name>
<url>${xxx.releases.distribution}</url>
</repository>
<snapshotRepository>
<id>xxx-snapshots</id>
<name>XXXSnapshots Repository</name>
<url>${xxx.snapshots.distribution}</url>
</snapshotRepository>
</distributionManagement>