我正在尝试在 Eclipse 中导入一个 Maven 项目。它给出了一个错误“更新 Maven 项目。安装 JAX-RS(REST Web 服务)1.1 时失败。'':无法为 JAX-RS 配置 Web 模块”。无法为 JAX-RS 配置 Web 模块。
以下是来自工作区 .metadeta 的错误日志。任何建议或修复?Java 版本 1.6 和 Jersey 版本 1.18.1。
ENTRY org.eclipse.wst.common.project.facet.core 4 0 2015-05-14 11:18:28.723
!MESSAGE Failed while installing JAX-RS (REST Web Services) 1.1.
!STACK 1
org.eclipse.jst.ws.jaxrs.core.internal.project.facet.JAXRSFacetException: '<project-name>' : unable to configure web module for JAX-RS
at org.eclipse.jst.ws.jaxrs.core.internal.project.facet.JAXRSFacetInstallDelegate.execute(JAXRSFacetInstallDelegate.java:103)
at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.callDelegate(FacetedProject.java:1477)
at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.modifyInternal(FacetedProject.java:441)
at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.mergeChangesInternal(FacetedProject.java:1181)
at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.access$2(FacetedProject.java:1117)
at org.eclipse.wst.common.project.facet.core.internal.FacetedProject$1.run(FacetedProject.java:324)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2313)
.....
.....
at org.eclipse.m2e.core.ui.internal.UpdateMavenProjectJob.runInWorkspace(UpdateMavenProjectJob.java:77)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
!SUBENTRY 1 org.eclipse.jst.ws.jaxrs.core …Run Code Online (Sandbox Code Playgroud) 我在 Eclipse Neon.1 上,当我创建新的 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>test</name>
</project>
Run Code Online (Sandbox Code Playgroud)
如何修改此默认模板?我想添加一些属性,例如
<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>
<groupId>com.example</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>test</name>
<properties>
<encoding>UTF-8</encoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>
Run Code Online (Sandbox Code Playgroud)
当然,我可以创建自己的原型并使用它来拥有这个 pom,但是该m2e插件是如此可配置,我希望这在没有原型的情况下也是可能的。
这是我的项目目录结构:
这是我的 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>borsa</groupId>
<artifactId>borsa</artifactId>
<version>1</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<build>
<finalName>aggiornamento</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/dist/libs
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<outputDirectory>${basedir}/target/dist</outputDirectory>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>libs/</classpathPrefix>
<mainClass>
borsa.Application
</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20.1</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId> …Run Code Online (Sandbox Code Playgroud) 我想构建两个不同版本的自定义 SonarQube (SQ) 插件;一个用于 SonarQube 6.7.x LTS 版本,一个用于最新的 7.6 版本。目前,我的 Maven 结构类似于以下内容:
插件 6.7 和 7.6 的大部分源代码和资源是相同的;只有少数类别不同。因此,我想将此通用代码移动到某个共享源文件夹/模块。
不过,我仍然想编译这个通用代码两次,以验证代码是否针对两个 SQ API 版本进行编译。在 Eclipse 中,这应该显示为两个单独的源文件夹或项目,因此我可以轻松验证公共代码不使用 6.7 API 中尚未提供的任何 SQ API,并且不使用任何已删除的 API或在 7.6 API 中已弃用。
最好我想坚持在一个构建中构建两个插件版本,所以如果可能的话我想避免使用两个单独的配置文件。
这有可能吗?
通过 Maven,我找到了几种让它工作的方法,但我无法让这些方法中的任何一种与 m2eclipse 一起工作。
方法一
创建一个新模块plugin-common,包含pom-6.7.xml和pom-7.6.xml。除了工件 ID 或分类器以及对不同 SQ API 版本的依赖之外,两个 pom 本质上是相同的。父项目将它们定义为 2 个独立的模块,使用
<module>plugin-common/pom-6.7.xml</module>
<module>plugin-common/pom-7.6.xml</module>
Run Code Online (Sandbox Code Playgroud)
这种方法的问题是我无法将这些模块导入 Eclipse,因为 m2eclipse 仅支持 pom.xml 作为文件名。
方法2
与上面类似,但为 pom.xml 文件使用单独的子目录,并使用<sourceDirectory>${project.basedir}/../src/main/java</sourceDirectory>指向公共源代码: …
我正在使用 Jersey 进行 REST 的第一步,然后使用m2e。经过对 tomcat 10 和 Java-17 的一些调整后,它在 tomcat 10.1 上部署得很好。
现在,我想做下一步,将新内容添加到 pom.xml 中。但是执行Maven / Update Project ...会导致失败消息:
Could not update project HelloREST configuration
Cannot invoke "org.eclipse.wst.common.componentcore.internal.WorkbenchComponent.findResourcesByRuntimePath(org.eclipse.core.runtime.IPath)"
because "aComponent" is null
Run Code Online (Sandbox Code Playgroud)
此外,错误日志还显示
eclipse.buildId=4.26.0.20221201-1200
java.version=17.0.5
java.vendor=Eclipse Adoptium
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments: -product org.eclipse.epp.package.jee.product
Command-line arguments: -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.jee.product
org.eclipse.m2e.logback.appender
Error
Tue Feb 07 13:19:45 CET 2023
HelloREST/.settings/org.eclipse.wst.common.component is missing or invalid. Skipping module dependency …Run Code Online (Sandbox Code Playgroud) 我使用Eclipse而且我遇到了严重的问题:-(首先我尝试为你重新构建我的情况:
我使用的是Windows XP Professional SP3
所以...现在Eclipse有很大的问题.当我尝试打开pom.xml或使用某些maven特定选项时,eclipse停止工作并发生permgen space错误,就像我上次会话中的情况一样:
!SESSION 2010-07-12 16:45:23.671 -----------------------------------------------
eclipse.buildId=I20100608-0911
java.version=1.6.0_21
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE
Framework arguments: -product org.eclipse.epp.package.jee.product
Command-line arguments: -os win32 -ws win32 -arch x86 -product org.eclipse.epp.package.jee.product
!ENTRY org.eclipse.core.resources 2 10035 2010-07-12 16:45:24.796
!MESSAGE The workspace exited with unsaved changes in the previous session; refreshing workspace to recover changes.
!ENTRY org.eclipse.ui 4 0 2010-07-12 16:54:53.046
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.OutOfMemoryError: …Run Code Online (Sandbox Code Playgroud) 我们正在调试java webapps,并希望使用jetty-maven-plugin来启动Jetty服务器.我所看到的所有文档都建议您应该从命令行执行此操作,这使得在Eclipse中调试和设置断点变得困难.另外,我想在控制台窗口中看到输出,并能够使用红色按钮停止该过程.并进行分析.
有人知道怎么做吗?
我在Windows 7上将Eclipse Juno与Maven 3.0.5一起使用。该项目以前在Windows XP上使用,并且我已移至Windows 7 64位计算机。
我已经复制了Eclipse Spring 3,Hibernate 4和JSF 2.0项目,并且在尝试编译时出现以下错误
Plugin execution not covered by lifecycle configuration:
org.bsc.maven:maven-processor-plugin:2.0.6:process (execution: process, phase:
generate-sources)
Run Code Online (Sandbox Code Playgroud)
我尝试通过在Eclipse.ini文件中添加以下内容来对此线程中提到的内容进行尝试,但是它没有解决问题。
-vm
c:\Program Files\Java\jdk1.7.0_21\jre\bin\server\jvm.dll
Run Code Online (Sandbox Code Playgroud)
尝试构建Maven安装并清理,但问题仍然存在。
我该如何解决这个问题?任何帮助都是非常明显的。
谢谢
Maven片段
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-proc:none</compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<version>2.0.6</version>
<executions>
<execution>
<id>process</id>
<goals>
<goal>process</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<!-- source output directory -->
<outputDirectory>target/metamodel</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Run Code Online (Sandbox Code Playgroud) 使用带有m2e插件的Eclipse Luna SR1,我使用Maven创建了一个Java Web项目.
如何在项目的pom.xml中删除默认项目方面(例如CDI,JPA等)?

在项目 - >属性中取消选中"项目构面",在Maven - >更新项目后重置.