8

我最近将项目构建从 ant 切换到 maven 和 m2e,这工作正常,现在突然每次我保存文件时,构建工作区都会占用大量时间,大约 5 到 10 秒,以前是当我刚刚保存一个文件时,我什至从未注意到 eclipse 做任何事情。

我猜测 m2e 在增量构建期间正在做一些事情,这会减慢速度。我不知道是什么导致了减速。我正在寻找可以尝试找出这种放缓的原因的东西。

我可以采取哪些选项或步骤来帮助我找出导致此问题的原因。

更新:这是一个多模块项目,包含 17 个模块、16 个罐子和一场战争。这是按照标准的 Maven 层次结构排列的。

更新:在非常快的机器上,Project clean all 需要大约 30 到 85 秒的挂钟时间。Web 项目本身需要大约 1 秒的时间来构建,我不知道问题出在 m2e 还是其他地方。

更新:保存 .java 文件会导致工作区重建,其长度可能为 0 到 15 秒,以不可预知的方式。

更新:我正在使用具有工作区工件分辨率的 m2e-wtp 扩展。

更新: m2e 日志文件的一些输出

2012-12-28 17:10:43,907 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.apache.maven.plugins:maven-enforcer-plugin:1.2:enforce (execution: enforce-rules, phase: validate)
2012-12-28 17:10:43,907 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -     Action: ignore
2012-12-28 17:10:43,907 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: pl.project13.maven:git-commit-id-plugin:2.1.2:revision (execution: default, phase: initialize)
2012-12-28 17:10:43,907 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -     Action: ignore
2012-12-28 17:10:43,907 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.apache.maven.plugins:maven-resources-plugin:2.6:resources (execution: default-resources, phase: process-resources)
2012-12-28 17:10:43,908 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -     Action: execute
2012-12-28 17:10:43,908 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (execution: default-compile, phase: compile)
2012-12-28 17:10:43,908 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -     Action: configurator
2012-12-28 17:10:43,908 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Project configurator id: org.eclipse.m2e.jdt.javaConfigurator
2012-12-28 17:10:43,908 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Project configurator: org.eclipse.m2e.jdt.internal.JavaProjectConfigurator
2012-12-28 17:10:43,908 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -     Action: configurator
2012-12-28 17:10:43,908 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Project configurator id: org.maven.ide.eclipse.configuration.wtp.webfragment.configurator
2012-12-28 17:10:43,908 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Project configurator: org.eclipse.m2e.wtp.WebFragmentProjectConfigurator
2012-12-28 17:10:43,908 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -     Action: configurator
2012-12-28 17:10:43,908 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Project configurator id: org.maven.ide.eclipse.configuration.wtp.utility.configurator
2012-12-28 17:10:43,908 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Project configurator: org.eclipse.m2e.wtp.UtilityProjectConfigurator
2012-12-28 17:10:43,908 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -     Action: configurator
2012-12-28 17:10:43,908 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Project configurator id: org.maven.ide.eclipse.configuration.wtp.java.unsupportedDependencyTypeConfigurator
2012-12-28 17:10:43,908 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Project configurator: org.eclipse.m2e.wtp.UnsupportedDependencyTypeProjectConfigurator
2012-12-28 17:10:43,908 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -     Action: configurator
2012-12-28 17:10:43,908 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Project configurator id: com.springsource.sts.ide.maven.core.springProjectConfigurator
2012-12-28 17:10:43,908 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Project configurator: org.springframework.ide.eclipse.maven.internal.core.SpringProjectConfigurator
2012-12-28 17:10:43,908 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.apache.maven.plugins:maven-resources-plugin:2.6:testResources (execution: default-testResources, phase: process-test-resources)
2012-12-28 17:10:43,908 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -     Action: execute
2012-12-28 17:10:43,909 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.apache.maven.plugins:maven-compiler-plugin:2.5.1:testCompile (execution: default-testCompile, phase: test-compile)
2012-12-28 17:10:43,909 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -     Action: configurator
2012-12-28 17:10:43,909 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Project configurator id: org.eclipse.m2e.jdt.javaConfigurator
2012-12-28 17:10:43,909 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Project configurator: org.eclipse.m2e.jdt.internal.JavaProjectConfigurator
2012-12-28 17:10:43,909 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -     Action: configurator
2012-12-28 17:10:43,909 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Project configurator id: org.maven.ide.eclipse.configuration.wtp.webfragment.configurator
2012-12-28 17:10:43,909 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Project configurator: org.eclipse.m2e.wtp.WebFragmentProjectConfigurator
2012-12-28 17:10:43,909 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -     Action: configurator
2012-12-28 17:10:43,909 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Project configurator id: org.maven.ide.eclipse.configuration.wtp.utility.configurator
2012-12-28 17:10:43,909 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Project configurator: org.eclipse.m2e.wtp.UtilityProjectConfigurator
2012-12-28 17:10:43,909 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -     Action: configurator
2012-12-28 17:10:43,909 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Project configurator id: org.maven.ide.eclipse.configuration.wtp.java.unsupportedDependencyTypeConfigurator
2012-12-28 17:10:43,909 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Project configurator: org.eclipse.m2e.wtp.UnsupportedDependencyTypeProjectConfigurator
2012-12-28 17:10:43,909 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -     Action: configurator
2012-12-28 17:10:43,909 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Project configurator id: com.springsource.sts.ide.maven.core.springProjectConfigurator
2012-12-28 17:10:43,909 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Project configurator: org.springframework.ide.eclipse.maven.internal.core.SpringProjectConfigurator
2012-12-28 17:10:43,909 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (execution: default-test, phase: test)
2012-12-28 17:10:43,909 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.apache.maven.plugins:maven-war-plugin:2.3:war (execution: default-war, phase: package)
2012-12-28 17:10:43,909 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -     Action: configurator
2012-12-28 17:10:43,909 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Project configurator id: org.maven.ide.eclipse.configuration.wtp.configurator
2012-12-28 17:10:43,909 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Project configurator: org.eclipse.m2e.wtp.WTPProjectConfigurator
2012-12-28 17:10:43,909 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Build participant: org.eclipse.m2e.wtp.internal.filtering.ResourceFilteringBuildParticipant
2012-12-28 17:10:43,910 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -     Action: configurator
2012-12-28 17:10:43,910 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Project configurator id: org.maven.ide.eclipse.configuration.wtp.warmanifest.configurator
2012-12-28 17:10:43,910 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Project configurator: org.eclipse.m2e.wtp.internal.mavenarchiver.WarMavenArchiverConfigurator
2012-12-28 17:10:43,910 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Build participant: org.sonatype.m2e.mavenarchiver.internal.AbstractMavenArchiverConfigurator$1
2012-12-28 17:10:43,910 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -     Action: configurator
2012-12-28 17:10:43,910 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Project configurator id: org.maven.ide.eclipse.configuration.wtp.overlay.configurator
2012-12-28 17:10:43,910 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping -         Project configurator: org.eclipse.m2e.wtp.OverlayConfigurator
2012-12-28 17:10:43,910 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.apache.maven.plugins:maven-install-plugin:2.4:install (execution: default-install, phase: install)
2012-12-28 17:10:43,910 [Worker-3] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (execution: default-deploy, phase: deploy)

更新: 这原来是 Eclipse STS 中的弹簧工具错误且缓慢,摆脱弹簧项目性质解决了问题。似乎 Spring 源代码团队知道这些问题正在修复,请参阅下面的我的答案以获取一些链接。

4

1 回答 1

7

经过一番摸索,结果发现 Spring Tool Suite 3.1 是问题所在,一旦我从项目工作区中删除了弹簧性质,构建时间从 30 - 90 秒降至不到 3 秒。

当我更改它以打印出调试信息时,我发现它 .metadata/.plugins/org.eclipse.m2e.logback.configuration/包含用于 m2e 日志记录的配置文件logback.1.2.0.20120903-1050.xml

  <root level="DEBUG">
    <appender-ref ref="FILE" />
    <appender-ref ref="STDOUT" />
    <appender-ref ref="EclipseLog" />
    <appender-ref ref="MavenConsoleLog" />
  </root>

  <logger name="com.ning.http.client" level="DEBUG" />

我可以在此输出中获得输出,.metadata/.plugins/org.eclipse.m2e.logback.configuration/0.log该输出具有时间戳,并且当 .java 文件获取时,m2e 似乎不止一次运行。

我一直无法弄清楚如何使用日志文件中的信息来解决我的问题,我非常接近放弃 m2e。我在这里发布此信息,以防它可能对其他人有用。

于 2012-12-28T22:02:56.167 回答