我正在使用 IntelliJ 开发 java maven 项目。
为了编译项目及其依赖项,我使用了很多mvn clean install
每次,我都会单击此图标上的 UI,然后单击重新加载(请参阅屏幕截图)
我尝试将此操作绑定到键盘或鼠标上的按钮。
但是,我找不到它是哪一个动作。
我能找到最接近的方法是绑定“运行配置”,但是,这并没有考虑到所有内容(屏幕截图中的所有步骤)
问题:
如何绑定mvn clean install
到按钮?
Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937)
Maven home: C:\Tools\apache-maven-3.9.9-bin
Java version: 1.8.0_431, vendor: Oracle Corporation, runtime: C:\Tools\Java\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
java version "1.8.0_431"
Java(TM) SE Runtime Environment (build 1.8.0_431-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.431-b10, mixed mode)
C:\Users\user\projectX>mvn validate
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------< projectX:projectX >--------------------------
[INFO] Building ProjectX 1.0-SNAPSHOT
[INFO] from pom.xml
[INFO] --------------------------------[ pom ]---------------------------------
Downloading ...
[INFO]
[INFO] --- enforcer:3.4.1:enforce (enforce-versions) @ projectX ---
Downloading ...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.259 s
[INFO] Finished at: 2024-12-04T10:37:41-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.4.1:enforce (enforce-versions) on project projectX: Execution enforce-versions of goal org.apache.maven.plugins:maven-enforcer-plugin:3.4.1:enforce failed: Plugin org.apache.maven.plugins:maven-enforcer-plugin:3.4.1 or one of its dependencies could not be resolved:
[ERROR] Could not transfer artifact commons-io:commons-io:jar:2.13.0 from/to nexus (https://nexus.xyz.com/repository/maven): status code: 403, reason phrase: -------------------->>> REQUESTED ITEM IS QUARANTINED -------------------->>> FOR DETAILS SEE ------>>> https://nexus-iq-server.xyz.com:8070/ui/links/repositories/quarantinedComponent/MzBlNmE1NmVjY2MyNDc5ZWI1MGZiNzAyMTkyZjVkODI <<<------ (403)
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
commons-io : commons-io : 2.13.0
9 Security-High High risk CVSS score
Found security vulnerability CVE-2024-47554 with severity >= 7 (severity = 8.7)
Found security vulnerability CVE-2024-47554 with severity < 9 (severity = 8.7)
Nexus 表示要升级到 2.16.0。comomns.io 的最新版本是 2.18.0。
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 https://nexus.xyz.com/repository/raw/schemas/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>projectX</groupId>
<artifactId>projectX</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>ProjectX</name>
<description>An example of Nexus blocking vulnerable dependencies in Maven Plugins</description>
<url></url>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.16.0</version>
<optional>false</optional>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.4.1</version>
<executions>
<execution>
<id>enforce-versions</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<fail>true</fail>
<rules>
<requireMavenVersion>
<version>3.2.5</version>
</requireMavenVersion>
<requireJavaVersion>
<version>[1.8,)</version>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
我通过 Nexus 访问 Maven 存储库。我尝试使用的许多插件都有一个或多个易受攻击的依赖项。Nexus 阻止了易受攻击的依赖项,构建失败。我创建了上述示例以尽可能简单地演示该问题。我将依赖项放在我的 pom 文件中,试图覆盖插件依赖项,但它不起作用。我的假设是,如果您在 pom 中的 dependencyManagement 中定义了依赖项,它将覆盖所有子依赖项版本,但这似乎是不正确的。有人知道纠正此问题的方法吗?任何帮助都将不胜感激。
我需要工件 A。因此,我将它包含在我的 pom.xml 中
<dependency>
<groupId>some.group</groupId>
<artifactId>some.artifact</artifactId>
<version>some.version</version>
</dependency
工件 A 使用了工件 B,而我绝对不想将其复制到我的类路径中。因此,我对 B 使用了排除
<dependency>
<groupId>some.group</groupId>
<artifactId>some.artifact</artifactId>
<version>some.version</version>
<exclusions>
<exclusion>
<groupId>dontwant.group</groupId>
<artifactId>dontwant.artifact</artifactId>
</exclusion>
<exclusions>
</dependency
我不依赖 B。但是,我依赖 A,并且 A 依赖于 B。B 现在未被复制到类路径。这会破坏我的代码吗?
我正在首次尝试使用 Netbeans、Maven 和 JavaFXML 开发一个小型桌面应用程序。我选择使用之前使用 Ant 开发的应用程序版本,并在 Maven 中运行它。但是在我的一个 Java 类中,Maven 版本标记了javax.swing.filechooser.FileSystemView
as的导入
package javax.swing.filechooser is not visible. Package javax.swing.filechooser is declared in module java.desktop but module myapp does not read it.
这个问题在之前的版本中没有出现过。我搜索了这个论坛、Oracle 论坛和许多网络搜索来寻找解决方案,但没有成功。如果能得到一些帮助来解决这个问题,我将不胜感激。
我搜索了这个论坛、Oracle 论坛和许多网络搜索,但都没有找到解决方案。我希望找到一个像“从这里下载 swing API”这样的答案,但似乎没有办法做到这一点。无论如何,Maven 的项目属性没有用于导入库的 ClassPath 选项。我希望得到一些帮助来解决这个问题,因为说实话,我自己不知道该怎么做。
Intellij Idea
成功识别到打开的项目是,Maven Project
并显示一个带有按钮的弹出窗口Load Maven Project
,但单击按钮后,什么也没有发生UI
。
我检查了Intellij Idea
日志文件,发现了多个这样的错误日志:
2024-09-23 21:28:20,439 [1325080] INFO - #ojimaven - 使用扩展 org.jetbrains.idea.maven.maven3.Maven3Support@59e87873 启动 MavenServer 2024-09-23 21:28:20,451 [1325092] INFO - #ojimaven - 已将令牌发送到 maven 服务器 2024-09-23 21:28:20,711 [1325352] WARN - #cierRemoteProcessSupport - 由于 java.net.SocketException:管道损坏,cook 无法启动 2024-09-23 21:28:20,753 [1325394] INFO - #cierRemoteProcessSupport - 正在终止: 127.0.0.1:61362/Maven36ServerImpl3157b954 2024-09-23 21:28:20,753 [1325394] INFO - STDERR - 线程“DefaultDispatcher-worker-14”中的异常 org.jetbrains.idea.maven.server.CannotStartServerException:java.util.concurrent.ExecutionException:java.rmi.ConnectIOException:JRMP 连接建立期间出错;嵌套异常为:2024-09-23 21:28:20,753 [1325394] INFO - STDERR - java.net.SocketException:管道损坏
似乎这些错误正是在我单击“加载 Maven 项目”按钮时引发的
关于如何修复它有什么想法吗?
我的环境如下:
我一直在关注 Lars Vogel 的教程 [https://www.vogella.com/tutorials/EclipseTycho/article.html#google_vignette]。我目前被困在 RCP 插件项目的编译错误中:
Software being installed: ... requires 'osgi.ee; (&(osgi.ee=JavaSE)(version=22))' but it could not be found
。有很多关于它的讨论,但我还没有看到解决方案。我想知道 Eclipse 版本:版本:2024-06 (4.32.0) 是否有针对上述问题的解决方案。关于这个问题的大多数讨论都超出了我的理解范围。下面是我的聚合器 pom 文件:
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.vogella.tycho</groupId>
<artifactId>releng</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<tycho.version>4.0.8</tycho.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
</properties>
<!--repositories>
<repository>
<id>eclipse</id>
<url>http://localhost:8080/site</url>
<layout>p2</layout>
</repository>
</repositories-->
<!--repositories>
<repository>
<id>my-repo1</id>
<name>your custom repo</name>
<url>https://mvnrepository.com/artifact/at.bestsolution.efxclipse.eclipse/javax.annotation</url>
</repository-->
<modules>
<module>MyFeature</module>
<module>MyPlugin</module>
<module>updatesite</module>
</modules>
<dependencies>
<!--
https://mvnrepository.com/artifact/javax.annotation/javax.annotation-api -->
<!--dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
</dependency-->
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>2.1.1</version>
<scope>provided</scope>
</dependency>
<!--dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.annotation</artifactId>
<version>3.0</version>
</dependency-->
<!-- https://mvnrepository.com/artifact/org.osgi.ee/ee.foundation -->
<!-- https://mvnrepository.com/artifact/org.osgi/org.osgi.core -->
<!-- https://mvnrepository.com/artifact/org.osgi.ee/ee.minimum -->
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-director-plugin</artifactId>
<version>${tycho.version}</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho.version}</version>
<extensions>true</extensions>
</plugin>
<!--Enable the replacement of the SNAPSHOT version in the final product configuration-->
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-packaging-plugin</artifactId>
<version>${tycho.version}</version>
<executions>
<execution>
<phase>package</phase>
<id>package-feature</id>
<configuration>
<finalName>
${project.artifactId}_${unqualifiedVersion}.${buildQualifier}</finalName>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho.version}</version>
<configuration>
<pomDependencies>wrapAsBundle</pomDependencies>
<!-- Optional set the Java version you are using-->
<executionEnvironment>JavaSE-21</executionEnvironment>
<target>
<file>../TargetDefinition/myTarget.target</file>
</target>
<environments>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86_64</arch>
</environment>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86_64</arch>
</environment>
<environment>
<os>macosx</os>
<ws>cocoa</ws>
<arch>x86_64</arch>
</environment>
</environments>
</configuration>
</plugin>
</plugins>
</build>
</project>
我有一个在 jetty 上运行的 jakarta ee 项目,我需要 cdi 和 faces。在开发过程中,我曾经通过jetty-ee10-maven-plugin
运行 的插件来运行它mvn jetty:run
。在本地执行mvn jetty:run
可以正常工作,没有任何问题。
现在项目已经基本准备就绪,我相信导出 war 并将其部署到 jetty 网络服务器上12.0.4
会很容易。
我的重要部分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>
<groupId>com.test</groupId>
<artifactId>web</artifactId>
<version>1.0.7</version>
<packaging>war</packaging>
<name>xyz_web</name>
<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<maven.compiler.release>21</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jetty.version>12.0.9</jetty.version>
<jetty.port>8080</jetty.port>
</properties>
<dependencies>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>13.0.8</version>
<classifier>jakarta</classifier>
</dependency>
<!-- https://mvnrepository.com/artifact/org.primefaces.extensions/primefaces-extensions -->
<dependency>
<groupId>org.primefaces.extensions</groupId>
<artifactId>primefaces-extensions</artifactId>
<version>13.0.8</version>
<classifier>jakarta</classifier>
</dependency>
<!-- https://mvnrepository.com/artifact/jakarta.platform/jakarta.jakartaee-api -->
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>${jakartaee-api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/jakarta.inject/jakarta.inject-api -->
<dependency>
<groupId>jakarta.inject</groupId>
<artifactId>jakarta.inject-api</artifactId>
<version>2.0.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/jakarta.ejb/jakarta.ejb-api -->
<dependency>
<groupId>jakarta.ejb</groupId>
<artifactId>jakarta.ejb-api</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>jakarta.faces</artifactId>
<version>4.0.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/jakarta.xml.bind/jakarta.xml.bind-api -->
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>4.0.2</version>
</dependency>
<dependency>
<groupId>org.jboss.weld.servlet</groupId>
<artifactId>weld-servlet-core</artifactId>
<version>5.1.2.Final</version>
<exclusions>
<exclusion>
<groupId>jakarta.el</groupId>
<artifactId>jakarta.el-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.omnifaces</groupId>
<artifactId>omnifaces</artifactId>
<version>4.3</version>
</dependency>
<!-- Other dependencies not related to jetty or server -->
<!-- Other dependencies not related to jetty or server -->
<!-- Other dependencies not related to jetty or server -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.12.1</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<release>${maven.compiler.release}</release>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.4.0</version>
<configuration>
<webResources>
<resource>
<filtering>true</filtering>
<directory>src/main/webapp</directory>
<includes>
<include>**/web.xml</include>
</includes>
</resource>
</webResources>
<warSourceDirectory>src/main/webapp</warSourceDirectory>
<webXml>${project.build.directory}/web.xml</webXml>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.jetty.ee10</groupId>
<artifactId>jetty-ee10-maven-plugin</artifactId>
<version>${jetty.version}</version>
<configuration>
<!-- see https://eclipse.dev/jetty/documentation/jetty-12/programming-guide/index.html#jetty-run-goal -->
<webApp>
<contextPath>/</contextPath>
</webApp>
<scan>5</scan>
<webXml>${project.build.directory}/web.xml</webXml>
<httpConnector>
<host>0.0.0.0</host>
<port>${jetty.port}</port>
<idleTimeout>300000</idleTimeout>
</httpConnector>
</configuration>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.ee10</groupId>
<artifactId>jetty-ee10-cdi</artifactId>
<version>${jetty.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
<!-- Parses all files in the specified directory and replaces properties expressions if found -->
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>${basedir}/src/main/webapp/WEB-INF</directory>
<includes>
<include>web.xml</include>
</includes>
<filtering>true</filtering>
<targetPath>${project.build.directory}</targetPath>
</resource>
</resources>
</build>
</project>
当我在该云码头服务器上部署 war 文件时出现以下错误:
Caused by:
java.lang.ClassNotFoundException: jakarta.websocket.server.ServerContainer
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:593)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
at org.eclipse.jetty.ee10.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:496)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
at com.sun.faces.config.FacesInitializer.handleWebSocketConcerns(FacesInitializer.java:251)
at com.sun.faces.config.FacesInitializer.onStartup(FacesInitializer.java:123)
at org.eclipse.jetty.ee10.servlet.ServletContainerInitializerHolder.doStart(ServletContainerInitializerHolder.java:155)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:171)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.ee10.servlet.ServletContextHandler$ServletContainerInitializerStarter.doStart(ServletContextHandler.java:3041)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
at org.eclipse.jetty.ee10.servlet.ServletContextHandler.startContext(ServletContextHandler.java:1289)
at org.eclipse.jetty.ee10.webapp.WebAppContext.startContext(WebAppContext.java:1223)
at org.eclipse.jetty.ee10.servlet.ServletContextHandler.lambda$doStart$0(ServletContextHandler.java:1042)
at org.eclipse.jetty.server.handler.ContextHandler$ScopedContext.call(ContextHandler.java:1147)
at org.eclipse.jetty.ee10.servlet.ServletContextHandler.doStart(ServletContextHandler.java:1039)
at org.eclipse.jetty.ee10.webapp.WebAppContext.doStart(WebAppContext.java:496)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
at org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:40)
at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:183)
at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:522)
at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:162)
at org.eclipse.jetty.deploy.providers.ScanningAppProvider.pathAdded(ScanningAppProvider.java:293)
at org.eclipse.jetty.deploy.providers.ContextProvider.pathAdded(ContextProvider.java:520)
at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.pathAdded(ScanningAppProvider.java:69)
at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:902)
at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:868)
at org.eclipse.jetty.util.Scanner.scan(Scanner.java:775)
at org.eclipse.jetty.util.Scanner$ScanTask.run(Scanner.java:147)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
因此,即使我不确定我是否尝试在内部添加此依赖项pom.xml
。
<!-- Added to solve "java.lang.ClassNotFoundException: jakarta.websocket.server.ServerContainer" -->
<dependency>
<groupId>org.glassfish.tyrus.bundles</groupId>
<artifactId>tyrus-standalone-client</artifactId>
<version>2.2.0</version>
</dependency>
现在我收到此错误:
java.lang.IllegalStateException: Unable to locate CDIProvider
at jakarta.enterprise.inject.spi.CDI.findAllProviders(CDI.java:139)
at jakarta.enterprise.inject.spi.CDI.getCDIProvider(CDI.java:92)
at jakarta.enterprise.inject.spi.CDI.current(CDI.java:65)
at org.jboss.weld.module.web.servlet.WeldInitialListener.contextInitialized(WeldInitialListener.java:89)
at org.jboss.weld.servlet.api.helpers.ForwardingServletListener.contextInitialized(ForwardingServletListener.java:34)
at org.jboss.weld.environment.servlet.EnhancedListener.onStartup(EnhancedListener.java:70)
at org.eclipse.jetty.ee10.servlet.ServletContainerInitializerHolder.doStart(ServletContainerInitializerHolder.java:155)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:171)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.ee10.servlet.ServletContextHandler$ServletContainerInitializerStarter.doStart(ServletContextHandler.java:3041)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
at org.eclipse.jetty.ee10.servlet.ServletContextHandler.startContext(ServletContextHandler.java:1289)
at org.eclipse.jetty.ee10.webapp.WebAppContext.startContext(WebAppContext.java:1223)
at org.eclipse.jetty.ee10.servlet.ServletContextHandler.lambda$doStart$0(ServletContextHandler.java:1042)
at org.eclipse.jetty.server.handler.ContextHandler$ScopedContext.call(ContextHandler.java:1147)
at org.eclipse.jetty.ee10.servlet.ServletContextHandler.doStart(ServletContextHandler.java:1039)
at org.eclipse.jetty.ee10.webapp.WebAppContext.doStart(WebAppContext.java:496)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
at org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:40)
at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:183)
at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:522)
at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:162)
at org.eclipse.jetty.deploy.providers.ScanningAppProvider.pathAdded(ScanningAppProvider.java:293)
at org.eclipse.jetty.deploy.providers.ContextProvider.pathAdded(ContextProvider.java:520)
at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.pathAdded(ScanningAppProvider.java:69)
at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:902)
at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:868)
at org.eclipse.jetty.util.Scanner.scan(Scanner.java:775)
at org.eclipse.jetty.util.Scanner$ScanTask.run(Scanner.java:147)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
我尝试了很多其他配置,添加了许多其他依赖项,但我找不到我所缺少的东西。
云端的Jetty服务器版本是12.0.4
。我的Jetty Serverstart.ini
文件如下:
#===========================================================
# Jetty Startup
#===========================================================
# To disable the warning message, comment the following line
--module=home-base-warning
# ---------------------------------------
# Module: ext
# Adds all jar files discovered in $JETTY_HOME/lib/ext
# and $JETTY_BASE/lib/ext to the servers classpath.
# ---------------------------------------
--module=ext
# ---------------------------------------
# Module: server
# Enables the core Jetty server on the classpath.
# ---------------------------------------
--module=server
### Common HTTP configuration
## Scheme to use to build URIs for secure redirects
# jetty.httpConfig.secureScheme=https
## Port to use to build URIs for secure redirects
jetty.httpConfig.securePort=443
# ---------------------------------------
# Module: jsp
# Enables JSP for all webapplications deployed on the server.
# ---------------------------------------
--module=ee10-jsp
--module=ee9-jsp
--module=ee8-jsp
# ---------------------------------------
# Module: resources
# Adds the $JETTY_HOME/resources and/or $JETTY_BASE/resources
# directory to the server classpath. Useful for configuration
# property files (eg jetty-logging.properties)
# ---------------------------------------
--module=resources
# ---------------------------------------
# Module: deploy
# Enables webapplication deployment from the webapps directory.
# ---------------------------------------
--module=deploy
jetty.deploy.scanInterval=1
--module=ee10-deploy
jetty.deploy.scanInterval=1
--module=ee9-deploy
jetty.deploy.scanInterval=1
--module=ee8-deploy
jetty.deploy.scanInterval=1
# ---------------------------------------
# Module: jstl
# Enables JSTL for all webapplications deployed on the server
# ---------------------------------------
--module=ee10-jstl
--module=ee9-jstl
--module=ee8-jstl
# ---------------------------------------
# Module: websocket
# Enable websockets for deployed web applications
# ---------------------------------------
--module=websocket-jetty
# ---------------------------------------
# Module: http
# Enables a HTTP connector on the server.
# By default HTTP/1 is support, but HTTP2C can
# be added to the connector with the http2c module.
# ---------------------------------------
--module=http
### HTTP Connector Configuration
## Connector port to listen on
jetty.http.port=80
## HTTP Compliance: RFC7230, RFC7230_LEGACY, RFC2616, RFC2616_LEGACY, LEGACY or CUSTOMn
# jetty.http.compliance=RFC7230_LEGACY
# ---------------------------------------
# Module: requestlog
# Enables a NCSA style request log.
# ---------------------------------------
--module=requestlog
## Logging directory (relative to $jetty.base)
jetty.requestlog.dir=../../var/log/jetty
# ---------------------------------------
# Module: gzip
# Enable GzipHandler for dynamic gzip compression
# for the entire server.
# ---------------------------------------
--module=gzip
使用 gradle 的典型方法是一步下载所有需要的包,然后在下一步构建。但假设您有数百个 gradle 项目,并且不想一步下载所有需要的包。我假设 bazel 有办法缓存每个包,对吗?如果是这样,它如何处理可能具有相同父包的并行下载包?它们可能会尝试同时写入相同的文件并发生冲突,对吗?父级未列在锁定文件中,因此如果不手动解析 pom 文件,很难知道以什么顺序下载内容。
我正在将一个项目从 Java 11 迁移到 17,同时从 Junit4 迁移到 Junit5。我修改所有测试,并添加此依赖项
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.9.1</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.9.1</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.9.1</version>
</dependency>
但是当我尝试运行测试时,它执行方法的主体,最后抛出此异常
Exception in thread "main" java.lang.NoSuchMethodError: 'java.util.Set org.junit.platform.engine.TestDescriptor.getAncestors()'
at org.junit.platform.launcher.core.StackTracePruningEngineExecutionListener.getTestClassNames(StackTracePruningEngineExecutionListener.java:50)
at org.junit.platform.launcher.core.StackTracePruningEngineExecutionListener.executionFinished(StackTracePruningEngineExecutionListener.java:39)
at org.junit.platform.launcher.core.DelegatingEngineExecutionListener.executionFinished(DelegatingEngineExecutionListener.java:46)
at org.junit.platform.launcher.core.OutcomeDelayingEngineExecutionListener.reportEngineFailure(OutcomeDelayingEngineExecutionListener.java:83)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:203)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:169)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:93)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:58)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:141)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:57)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:103)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:85)
at org.junit.platform.launcher.core.DelegatingLauncher.execute(DelegatingLauncher.java:47)
at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:63)
at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57)
at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:232)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)
我知道有类似的问题,但它们都适用于构建,我使用的是 Maven 3.9.6。我已经检查了依赖关系树,我无法在这里分享它,但这是测试依赖关系的一部分
[INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.9.1:compile
[INFO] | +- org.opentest4j:opentest4j:jar:1.2.0:compile
[INFO] | +- org.junit.platform:junit-platform-commons:jar:1.9.1:compile
[INFO] | \- org.apiguardian:apiguardian-api:jar:1.1.2:compile
[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.9.1:compile
[INFO] | \- org.junit.platform:junit-platform-engine:jar:1.9.1:compile
[INFO] +- org.junit.jupiter:junit-jupiter-params:jar:5.9.1:compile
[INFO] +- org.junit.platform:junit-platform-launcher:jar:1.10.1:compile
[INFO] +- org.springframework:spring-test:jar:6.1.1:compile
感谢您的意见
我想弄清楚如何在编译和运行时同步 junit 版本,因为我认为问题是因为它们不同,但我没有发现区别
我有一个具有以下结构的项目:
parent
|-api
|-plugin (depends on api)
该项目是使用clean install package
父模块上的 Maven 任务构建的。JAR 可以正确生成,但 javadoc 不能正确生成。我怎样才能解决这个问题?
这是我的父模块的 pom 的样子:
<?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>
<groupId>PluginLogger</groupId>
<artifactId>parent</artifactId>
<version>1.1</version>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<modules>
<module>plugin</module>
<module>api</module>
</modules>
// repositories and dependencies go here...
<build>
<defaultGoal>clean install package</defaultGoal>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.6.3</version>
<configuration>
<outputDirectory>${project.build.directory}/javadoc</outputDirectory>
<sourceFileIncludes>
<include>**/me/suprB/pluginlogger/api/**/*.java</include>
</sourceFileIncludes>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<phase>package</phase>
<goals>
<goal>aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
我只想为“api”模块生成Javadoc,而不是“插件”模块。