Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 344217 - Running formatter from the command line breaks with error
Summary: Running formatter from the command line breaks with error
Status: VERIFIED DUPLICATE of bug 340181
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6.2   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.7.1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-28 18:31 EDT by panayotis CLA
Modified: 2011-09-09 09:38 EDT (History)
4 users (show)

See Also:


Attachments
.settings/org.eclipse.jdt.core.prefs (22.07 KB, text/plain)
2011-04-28 18:32 EDT, panayotis CLA
no flags Details
.settings/org.eclipse.jdt.ui.prefs file (22.07 KB, text/plain)
2011-04-28 18:33 EDT, panayotis CLA
no flags Details
plugins (40.30 KB, text/plain)
2011-04-29 11:36 EDT, panayotis CLA
no flags Details
plugins list after clean install (20.37 KB, text/plain)
2011-04-29 11:52 EDT, panayotis CLA
no flags Details
The test project I am using, just in case... (5.75 KB, application/octet-stream)
2011-04-29 11:54 EDT, panayotis CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description panayotis CLA 2011-04-28 18:31:19 EDT
Build Identifier: M20110210-1200

I am trying to run the formatter from the command line with a command similar to this:

/path/to/eclipse -nosplash -application org.eclipse.jdt.core.JavaCodeFormatter -verbose -config .settings/org.eclipse.jdt.core.prefs path/to/java/src

Unfortunately I get this error message instead and formatter stops:

[org.eclipse.contribution.weaving.jdt] error at org/eclipse/contribution/jdt/IsWovenTester.aj::0 class 'org.eclipse.contribution.jdt.IsWovenTester' is already woven and has not been built in reweavable mode
[org.eclipse.contribution.weaving.jdt] error at org/eclipse/contribution/jdt/IsWovenTester.aj::0 class 'org.eclipse.contribution.jdt.IsWovenTester$WeavingMarker' is already woven and has not been built in reweavable mode
[org.eclipse.jdt.core] warning at org/eclipse/contribution/jdt/sourceprovider/SourceTransformerAspect.aj:106::0 does not match because declaring type is org.eclipse.jdt.core.IOpenable, if match desired use target(org.eclipse.jdt.core.ICompilationUnit) [Xlint:unmatchedSuperTypeInCall]
	see also: org/eclipse/jdt/internal/core/SourceRefElement.java:198::0
A problem occurred while reading the config file .settings/org.eclipse.jdt.core.prefs.

Usage: eclipse -application org.eclipse.jdt.core.JavaCodeFormatter [ OPTIONS ] -config <configFile> <files>

   <files>   Java source files and/or directories to format.
             Only files ending with .java will be formatted in the given directory.
   -config <configFile> Use the formatting style from the specified properties file.
                        Refer to the help documentation to find out how to generate this file.

 OPTIONS:

   -help                Display this message.
   -quiet               Only print error messages.
   -verbose             Be verbose about the formatting job.


Reproducible: Always

Steps to Reproduce:
1. Create a new java project
2. Open preferences, select specific formatting for this project
3. Close eclipse
4. Run the above command
Comment 1 panayotis CLA 2011-04-28 18:32:22 EDT
Created attachment 194320 [details]
.settings/org.eclipse.jdt.core.prefs
Comment 2 panayotis CLA 2011-04-28 18:33:07 EDT
Created attachment 194321 [details]
.settings/org.eclipse.jdt.ui.prefs   file
Comment 3 panayotis CLA 2011-04-28 18:37:09 EDT
Comment on attachment 194321 [details]
.settings/org.eclipse.jdt.ui.prefs   file

#Fri Apr 29 01:12:15 EEST 2011
eclipse.preferences.version=1
formatter_profile=org.eclipse.jdt.ui.default.eclipse_profile
formatter_settings_version=11
Comment 4 Olivier Thomann CLA 2011-04-29 11:08:00 EDT
Are you formatting aspectJ files ?
Comment 5 panayotis CLA 2011-04-29 11:14:35 EDT
No, just plain Java files.
Comment 6 Olivier Thomann CLA 2011-04-29 11:22:00 EDT
Do you have aspectJ installed ? Your stacktrace shows aj files.
Please paste your installation information so that we can see what is installed and what might cause the problem.
Comment 7 panayotis CLA 2011-04-29 11:36:13 EDT
Created attachment 194370 [details]
plugins

Attached is a list of plugins (by issuing the command "cd eclipse/plugins ; ls "
Comment 8 panayotis CLA 2011-04-29 11:37:06 EDT
PS: I didn't install myself any plugin at all. This is a clean Eclipse installation for Mac OSX. I did this to minimize possible problems.
Comment 9 Olivier Thomann CLA 2011-04-29 11:43:53 EDT
This is not a clean install.
You have aspectj and scala:

-rw-r--r--   1 teras  staff     98920 Apr 29 00:28 org.aspectj.runtime_1.6.10.20101003133000.jar
-rw-r--r--   1 teras  staff   1470572 Apr 29 00:28 org.aspectj.weaver_1.6.10.20101003133000.jar

-rw-r--r--   1 teras  staff   9334601 Apr 29 00:29 org.scala-ide.scala.compiler_2.8.1.final-p0003.jar
-rw-r--r--   1 teras  staff   8021315 Apr 29 00:29 org.scala-ide.scala.library_2.8.1.final-p0003.jar
-rw-r--r--   1 teras  staff    124782 Apr 29 00:28 org.scala-ide.sdt.aspects_1.0.0.201102131804-milestones-M01.jar
-rw-r--r--   1 teras  staff    506234 Apr 29 00:28 org.scala-ide.sdt.compiler.ext_1.0.0.201102131804-milestones-M01.jar
-rw-r--r--   1 teras  staff   2014919 Apr 29 00:28 org.scala-ide.sdt.core_1.0.0.201102131804-milestones-M01.jar
-rw-r--r--   1 teras  staff   1193320 Apr 29 00:28 org.scala-refactoring.library_0.3.0.201104172328.jar
-rw-r--r--   1 teras  staff   1742044 Apr 29 00:29 scalariform_0.1.0.201104172333.jar

Could you please try with a plain Eclipse SDK to see if you still have the problem ?
Comment 10 panayotis CLA 2011-04-29 11:52:58 EDT
Created attachment 194376 [details]
plugins list after clean install

hmm I was sure that this was a clean install.
In any case now I try with a fresh install, new plugin list attached
Comment 11 panayotis CLA 2011-04-29 11:54:37 EDT
Created attachment 194377 [details]
The test project I am using, just in case...
Comment 12 Olivier Thomann CLA 2011-05-05 12:05:53 EDT
(In reply to comment #10)
> hmm I was sure that this was a clean install.
> In any case now I try with a fresh install, new plugin list attached
Do you still have the problem with a fresh install ?
Comment 13 Olivier Thomann CLA 2011-05-06 17:39:26 EDT
Any update on this ?
Comment 14 panayotis CLA 2011-05-06 18:31:44 EDT
Exactly the same behavior...
I attached also the plugin list and a test project, just in case.
Probably the problem is because I am on a Mac? Should it matter?
Comment 15 Olivier Thomann CLA 2011-05-09 13:35:15 EDT
Mac OS should not change anything.
I tried your test case using the project you attached and it works fine.

Is the stacktrace identical after you used a fresh install ?

The stacktrace in comment 0 clearly shows that aspectJ is causing grief. If you don't install it again, then the error must be different.

Without further steps or help to reproduce this issue, I will have to close as WORKSFORME.
Comment 16 panayotis CLA 2011-05-12 05:51:37 EDT
I created a new (fresh) account.
I also re-downloaded Eclipse, only to use for this clean account, just in case.

The output from the console is as follows:

$ cd Downloads/TestProject/
$ /Users/test/Downloads/eclipse/eclipse -nosplash -application org.eclipse.jdt.core.JavaCodeFormatter -verbose -config .settings/org.eclipse.jdt.core.prefs ./src/
A problem occurred while reading the config file .settings/org.eclipse.jdt.core.prefs.

Usage: eclipse -application org.eclipse.jdt.core.JavaCodeFormatter [ OPTIONS ] -config <configFile> <files>

   <files>   Java source files and/or directories to format.
             Only files ending with .java will be formatted in the given directory.
   -config <configFile> Use the formatting style from the specified properties file.
                        Refer to the help documentation to find out how to generate this file.

 OPTIONS:

   -help                Display this message.
   -quiet               Only print error messages.
   -verbose             Be verbose about the formatting job.
Comment 17 Olivier Thomann CLA 2011-05-12 09:58:51 EDT
ok, I'll try to get a mac to give it a try.
Comment 18 Olivier Thomann CLA 2011-05-12 10:59:58 EDT
It works fine on Linux using a 1.6 VM.

What VM are you using on MacOS ?
Comment 19 Olivier Thomann CLA 2011-05-12 11:35:50 EDT
From where are you running the command line ?
I could reproduce when the paths to the config file was wrong. Once everything was fine, I could not longer reproduce.
Comment 20 panayotis CLA 2011-05-12 13:25:25 EDT
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode)


I "cd" in the project path, i.e. if I unzip the file, I do something like
"cd TestProject"

Or, in other words:

$ ls -la
total 32
drwxr-xr-x@ 8 demo  staff   272 May 12 12:47 .
drwx------+ 6 demo  staff   204 May 12 12:47 ..
-rw-r--r--@ 1 demo  staff  6148 May 12 12:47 .DS_Store
-rw-r--r--@ 1 demo  staff   226 Apr 29 01:12 .classpath
-rw-r--r--@ 1 demo  staff   370 Apr 29 01:12 .project
drwxr-xr-x@ 5 demo  staff   170 May 12 12:47 .settings
drwxr-xr-x@ 3 demo  staff   102 Apr 29 01:12 bin
drwxr-xr-x@ 3 demo  staff   102 Apr 29 01:12 src


If you believe it will help, I could private tell you the credentials to log in to my mac system and have a look.
Comment 21 Olivier Thomann CLA 2011-05-12 14:00:11 EDT
> If you believe it will help, I could private tell you the credentials to log in
> to my mac system and have a look.
I think this is the only way for me to find out what is going on. What is your time zone ?
Comment 22 Olivier Thomann CLA 2011-05-12 15:36:07 EDT
After investigation, it looks like the problem comes from the relative path used to point to the preferences file. If absolute paths are used, then it runs fine.
I'll add some debug statement in verbose mode to try to see what is different on MacOS.
Everything works fine on Linux and Windows.

I am tagging as 3.7.1 as I am not sure we can properly fix this for 3.7.
Comment 23 Olivier Thomann CLA 2011-05-13 13:18:27 EDT

*** This bug has been marked as a duplicate of bug 340181 ***
Comment 24 Ayushman Jain CLA 2011-05-17 10:48:49 EDT
Satyam, can you please check this on your Mac? Thanks!
Comment 25 Olivier Thomann CLA 2011-09-09 09:38:46 EDT
Verified.