formatter-maven-plugin: Failure using Oxygen.1a version (2.7.1): "Workspace is closed." error
I tried to run the 2.7.1 version with the patch from #259 on Apache Fluo, but there is a problem. It results in the following error about “Workspace is closed.” Googling for this error results in a hint that there may be some problem with the MANIFEST.MF in the JDT dependency. Version 2.7.0 works fine, which uses the org.eclipse.jdt version of jdt-core 3.13.0, instead of the version from org.eclipse.tycho.
The 2.7.1 version works fine on some other projects, such as Apache Accumulo, so I’m not sure what the problem could be. It could be that there’s something else on the class path while building the larger Apache Accumulo project, which satisfies whatever requirement is causing the IllegalStateException with the “Workspace is closed.” message, but I don’t know what that could be.
[ERROR] Failed to execute goal net.revelc.code.formatter:formatter-maven-plugin:2.7.1:format (format-source) on project fluo-api: Execution format-source of goal net.revelc.code.formatter:formatter-maven-plugin:2.7.1:format failed: Workspace is closed. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal net.revelc.code.formatter:formatter-maven-plugin:2.7.1:format (format-source) on project fluo-api: Execution format-source of goal net.revelc.code.formatter:formatter-maven-plugin:2.7.1:format failed: Workspace is closed.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution format-source of goal net.revelc.code.formatter:formatter-maven-plugin:2.7.1:format failed: Workspace is closed.
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
Caused by: java.lang.IllegalStateException: Workspace is closed.
at org.eclipse.core.resources.ResourcesPlugin.getWorkspace(ResourcesPlugin.java:412)
at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.createParser(DefaultCodeFormatter.java:332)
at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.parseSourceCode(DefaultCodeFormatter.java:317)
at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.prepareFormattedCode(DefaultCodeFormatter.java:213)
at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.prepareFormattedCode(DefaultCodeFormatter.java:206)
at org.eclipse.jdt.internal.formatter.CommentsPreparator.formatCode(CommentsPreparator.java:1063)
at org.eclipse.jdt.internal.formatter.CommentsPreparator.handleFormatCodeTag(CommentsPreparator.java:801)
at org.eclipse.jdt.internal.formatter.CommentsPreparator.handleHtml(CommentsPreparator.java:665)
at org.eclipse.jdt.internal.formatter.CommentsPreparator.endVisit(CommentsPreparator.java:621)
at org.eclipse.jdt.core.dom.TagElement.accept0(TagElement.java:282)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2796)
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2867)
at org.eclipse.jdt.core.dom.Javadoc.accept0(Javadoc.java:205)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2796)
at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.prepareComments(DefaultCodeFormatter.java:399)
at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.prepareFormattedCode(DefaultCodeFormatter.java:222)
at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.format(DefaultCodeFormatter.java:177)
at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.format(DefaultCodeFormatter.java:160)
at net.revelc.code.formatter.java.JavaFormatter.doFormat(JavaFormatter.java:46)
at net.revelc.code.formatter.AbstractCacheableFormatter.formatFile(AbstractCacheableFormatter.java:47)
at net.revelc.code.formatter.FormatterMojo.doFormatFile(FormatterMojo.java:511)
at net.revelc.code.formatter.FormatterMojo.formatFile(FormatterMojo.java:466)
at net.revelc.code.formatter.FormatterMojo.execute(FormatterMojo.java:344)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
... 21 more
[ERROR]
[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/PluginExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :fluo-api
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 16 (8 by maintainers)
Version 2.7.2 of this plugin is now tagged and also released to Maven Central. Website has also been updated to reflect this.
Now that Oxygen.3 is out, I have asked on the JDT Mailing list when the artifact will be published on Maven Central.
This issue was fixed in the upstream project with commit: https://github.com/eclipse/eclipse.jdt.core/commit/41b609123705d8e31de5555a8c4ed6a6ac0229b6
I think that the fix will be published with the Oxygen.3 release in March 2018. Around after this date, a new version should be available on maven central.
Looks like
org.eclipse.jdthasorg.eclipse.jdt.core:3.13.101as of today.https://repo.maven.apache.org/maven2/org/eclipse/jdt/org.eclipse.jdt.core/
Adding a dependency on that to my POM looks like it fixed this for me.
Here’s a link to the Maven Central search results to more easily check for when the updated version is published. (Saves me from periodic manual searching.)
In order to help with the upstream issue in the Eclipse bugzilla, I have added a simple class with a
mainmethod that reproduces the problem: MainFormatter.java, see Comment 3For my tests, I have used the latest jdt version available on Maven Central:
Thanks you wborn for you detailed analysis.
@ctubbsii I’ve submitted the following issue: https://bugs.eclipse.org/bugs/show_bug.cgi?id=528085