我想将现有的maven项目导入eclipse.我发现了两种方法:
1)通过从命令行运行mvn eclipse:eclipse
2)从eclipse安装两个maven eclipse插件.
两者之间有什么区别,哪一个更好?
如果我通过eclipse菜单安装maven eclipse插件Help -> Install New Software,我还需要修改我的pom.xml以在插件部分中包含maven eclipse插件吗?
我想使用Maven制作web项目自动导入我需要的所有库,所以我选择了 "maven-archetype-webpp"
之后我在pom.xml文件上出现了这个错误:
Description Resource Path Location Type Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 from/to central (http://repo.maven.apache.org/maven2): The operation was cancelled. pom.xml /SpringTuto line 1 Maven Configuration Problem
Run Code Online (Sandbox Code Playgroud)
我已经更新了我的Maven项目,但没有结果!
POM.XML:
<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.pre.example</groupId>
<artifactId>SpringTuto</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>SpringTuto Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope> …Run Code Online (Sandbox Code Playgroud) 我正在尝试按照下面给出的步骤创建 Java9 的 HelloWorld 模块。
右键单击项目(即 com.hello)>新建>源文件夹>输入源文件夹名称(即com.hello)
右键单击源文件夹(即com.hello)>新建>文件>输入文件名(模块的java9标准文件名是module-info.java)
module com.hello {
exports com.hello;
}
Run Code Online (Sandbox Code Playgroud)右键Package(即com.hello)>New>输入类名(即HelloWorld)
package com.hello;
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
Run Code Online (Sandbox Code Playgroud)右键单击HelloWorld>Run As>Java Application It throws
启动层初始化时出错
java.lang.module.FindException:未找到模块 com.hello
PS:尝试此解决方案后,我的项目结构如下所示
注意:我还注意到一件事。保存更改后。日食(氧气)投掷
构建过程中发生错误。在项目“com.hello”上运行构建器“Java Builder”时出错。未知常量池类型 19
我正在使用Ubuntu 12.04 LTS上的Eclipse 3.7(indigo),我正在尝试安装Maven插件.
在此页面之后,我将http://download.eclipse.org/technology/m2e/releases添加到Eclipse安装新软件提示框中.它识别了URL并显示了"Maven Integration for Eclipse"
但是,当我单击Next时,它会出现此错误.
Cannot complete the install because one or more required items could not be found.
Software being installed: m2e - Maven Integration for Eclipse 1.4.0.20130601-0317 (org.eclipse.m2e.feature.feature.group 1.4.0.20130601-0317)
Missing requirement: Maven Integration for Eclipse (Editors) 1.4.0.20130601-0317 (org.eclipse.m2e.editor 1.4.0.20130601-0317) requires 'bundle org.slf4j.api 1.6.2' but it could not be found
Cannot satisfy dependency:
From: m2e - Maven Integration for Eclipse 1.4.0.20130601-0317 (org.eclipse.m2e.feature.feature.group 1.4.0.20130601-0317)
To: org.eclipse.m2e.editor [1.4.0.20130601-0317]
Run Code Online (Sandbox Code Playgroud)
我该怎么办?请帮忙.
在线程"main"java.lang.NoClassDefFoundError:com/google/common/util/concurrent/FutureCallback中获取错误异常,同时在代码下运行.请告知我缺少哪个Jar文件.我正在从Eclipse IDE执行
package Datastax;
import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.Host;
import com.datastax.driver.core.Metadata;
import com.datastax.driver.core.Session;
public class DataStaxPOC {
private Cluster cluster;
public void connect(String node) {
cluster = Cluster.builder().addContactPoint(node).build();
Metadata metadata = cluster.getMetadata();
System.out.printf("Connected to cluster: %s\n", metadata.getClusterName());
for ( Host host : metadata.getAllHosts() ) {
System.out.printf("Datatacenter: %s; Host: %s; Rack: %s\n",host.getDatacenter(), host.getAddress(), host.getRack());
}
}
public void close() {
cluster.shutdown();
}
public static void main(String[] args) {
DataStaxPOC client = new DataStaxPOC();
client.connect("127.0.0.1");
client.close();
}
}
Run Code Online (Sandbox Code Playgroud) eclipse ×5
java ×3
maven ×2
cassandra ×1
datastax ×1
java-9 ×1
java-module ×1
maven-2 ×1
pom.xml ×1
ubuntu-12.04 ×1