How to ignore node shebang error in Eclipse? - eclipse

I am writing some node command line utilities. They all start with the line:
#!/usr/bin/env node
With Eclipse Juno and the Nodeclipse Node.js plugin, this line of code produces an error as shown:
OK, so # is not a valid comment character in javascript, but it is a valid character in Linux/UNIX as the shebang of the first line in a file. But how can I set up Eclipse to ignore this error? This is a problem for me because code formatting does not work if you have errors. I have to delete the line. Hit CTRL-SHIFT-F and add the line back.
I have tried a lot of things and researched, but I can't find an answer.
There is a duplicate question out there, eclipse javascript syntax error on hashbang line, but my question has more info.
EDIT:
Looks like there was something added to jshint to allow shebangs in the first line. Maybe I need to update my node-eclipse, or maybe the node-eclipse project needs to update jshint?
My jshint eclipse integration is version 0.9.6.
My nodeclipse is 0.4.0.20130519...
I upgraded to
jshint eclipse integration 0.9.9.20131029
nodeclipse 0.7.0.20131101
That did not help.
Here is my JSHint version in eclipse:
EDIT 2:
Thanks for the answer VonC. But I think this shows that I do not have a BOM in the file. Any other ideas?
$ od -N 20 -t x1 hello.js
0000000 23 21 2f 75 73 72 2f 62 69 6e 2f 65 6e 76 20 6e
0000020 6f 64 65 0a
0000024
EDIT 3:
With regard to Paul Verest's answer below, I tried to turn off JSDT validation, but I can't seem to do it. I unchecked "Enable JavaScript semantic validation" (In Eclipse, see Window > Preferences > JavaScript > Validator > Errors/Warnings), but the issue remains.
I am now uninstalling Eclipse Web Developer Tools 3.4.2. That did not seem to help and now my CSS and HTML editors are gone. Now I have tried to disable JSDT validation by following some of the ideas in this SO question, How do I remove javascript validation from my eclipse project?.
So I went into my project properties and went to JavaScript > Validation. I have set everything to "Enabled project specific settings" and unchecked "Errors/Warnings", "JSDOC", etc. Even so, I think validation is still running since the problem persists! My "Builders" Properties only lists the "JSHint Problem Checker" which is enabled. (I am doing all this on a new test project with a hello.js).
EDIT 4, THE ANSWER
It was not easy, but I ended up hacking the .project file in Eclipse. I had this:
<natures>
<nature>org.nodeclipse.ui.NodeNature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
I removed the jsdt nature and now the error on the shebang line is GONE! I did this in my test project and my real project. It worked! This is actually pretty helpful since I can format the file and I'm actually running jshint now.

There are 2 option for JavaScript validation in Eclipse:
JSDT
JSHint (default since Nodeclipse 0.7)
As configration is stored per project, copy .* settings files from project created with 0.7 or re-configure it manually (just compare .* files with newly created project).
Then put .jshintrc file like
https://github.com/Nodeclipse/nodeclipse-1/blob/master/org.nodeclipse.ui/templates/.jshintrc
Try to check JSHint options, if it is possible.
Note that with JSHint usage, ~~this question becomes general JSHint question (not Eclipse or Nodeclipse related).~~
UPDATE:
.project content since 0.7 :
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ProjectName</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.eclipsesource.jshint.ui.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.nodeclipse.ui.NodeNature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
As #Jess discovered this was error shown by JSDT, not JSHInt,
so removing <nature>org.eclipse.wst.jsdt.core.jsNature</nature> will stop JSDT from displaying it (even with JavaScript semantic validation already turned off since 0.7)
UPDATE 3:
Drawback of <nature>org.eclipse.wst.jsdt.core.jsNature</nature> removed will be that code assist and click-though to definition will not work (It actually works in rare cases when JSDocs are defined e.g. http://www.nodeclipse.org/nodejs/javascript/sources/books/2013/10/22/JSDT-require-JSDoc.html or within 1 .js file)
Even click-through to definition

Update:
The issue entered in nodeclipse points out to JSHint issue 66.
As Paul Verest remarks in his answer (upvoted), this could be as simple as making sure JSHint check the code.
Since commit 63da9, JSHint knows how to ignore that shebang directive.
// If the first line is a shebang (#!), remove it and move on.
// Shebangs are used by Node scripts.
if (lines[0] && lines[0].substr(0, 2) == '#!')
lines.shift();
Original answer
Are you sure '#' is not a valid character (yet used in this question)?
Double-check the encoding of your node.js file, because if it is UTF-8 with BOM, then the javascript couldn't be launched properly.
See "What's different between utf-8 and utf-8 without BOM?", and the wikipedia article on shebang (section "Magic number")
The shebang characters are represented by the same two bytes in extended ASCII encodings, including UTF-8, which is commonly used for scripts and other text files on current Unix-like systems.
However, UTF-8 files may begin with the optional byte order mark (BOM); if the "exec" function specifically detects the bytes 0x23 0x21, then the presence of the BOM (0xEF 0xBB 0xBF) before the shebang will prevent the script interpreter from being executed.
Some authorities recommend against using the byte order mark in POSIX (Unix-like) scripts, for this reason and for wider interoperability and philosophical concerns.

Related

Why is Saxon throwing an error with the CentOS-distributed saxon.jar, but not with the saxon code from sourceforge?

I have an existing CentOS 7 server (setup by someone else, of course) running Saxon. If I run:
/usr/bin/java net.sf.saxon.Transform -s:input.xml -xsl:input.xsl -o:output.xml
...it works perfectly.
On a new server, I've installed Saxon via "yum install saxon". If I attempt the same command, it fails with the error:
Error at HTML on line 19 column 38 of 2.xsl:
XTSE0150: Simplified stylesheet: xsl:version attribute is missing
Failed to compile stylesheet. 1 error detected.
If I download the latest Saxon from sourceforge.net/projects/saxon, redirect my CLASSPATH from the yum-installed saxon.jar (dated 2014!) to the jar files from sourceforge, the transform works perfectly.
So, I have a FIX for the problem (i.e. use the latest from sourceforge, not CentOS's out-dated version) but I'm still curious as to what's going on.
Is this simply some old bug that's fixed in a newer release? Or maybe I'm missing supporting files that are in the sourceforge-derived jars, but not in the yum-derived files? Or something else???
For what it's worth, here's the head of my XSLT file. The error is specifically pointing at the end of the xsl:stylesheet tag, although there is clearly a "version=" setting in that config:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:oai-pmh="http://www.openarchives.org/OAI/2.0/"
xmlns:oai_qdc="http://worldcat.org/xmlschemas/qdc-1.0/"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:dcmitype="http://purl.org/dc/dcmitype/"
xmlns:edm="http://www.europeana.eu/schemas/edm/"
xmlns:oclcdc="http://worldcat.org/xmlschemas/oclcdc-1.0/"
xsi:schemaLocation="http://worldcat.org/xmlschemas/qdc-1.0/
http://worldcat.org/xmlschemas/qdc/1.0/qdc-1.0.xsd
http://purl.org/net/oclcterms
http://worldcat.org/xmlschemas/oclcterms/1.4/oclcterms-1.4.xsd"
exclude-result-prefixes="xs"
version="2.0"
xmlns="http://www.loc.gov/mods/v3">
Given that the code works perfectly fine with the alternate Saxon install, I don't believe that there's a problem with the code. It's something else, but I don't know what...
You can find out which version of Saxon is in a particular JAR file by doing
java -cp saxon.jar net.sf.saxon.Version
and this would be a lot more useful than just telling us where you installed it from.
The error message suggests to me that the "stylesheet" being used is actually not a stylesheet at all, but an ordinary XML document. (Saxon sees that the root element isn't xsl:stylesheet, so it decides it must be a simplified stylesheet; then it looks for the xsl:version attribute, finds that there isn't one, and complains).
I don't know exactly what's wrong here, but the application is using an invocation of Saxon that works with one release and doesn't work with the other. There haven't been many incompatible changes to the command line interface over the 20 years of Saxon's life, but there have been a few, and I suspect one of these Saxon versions is very old indeed.
AFTERTHOUGHT
There's another clue which I missed on first reading: the error message refers to a file called 2.xsl. From the supplied information, we can't see what 2.xsl is. It must be the file that appears to be a stylesheet but isn't... But why does it have a different name? Certainly the fact that your file has the end of the start tag at line 19, and so does this mystery file, appears significant. Perhaps there's some script that's being executed before Saxon actually gets invoked, and that creates 2.xsl?

Colored output in netbeans console with ansicodes

I am trying to get a colored output in my Netbeans output window.
Ansi-Output in Linux and Windows console works perfectly fine. However not in the IDE.
Is there a way to make this work in Netbeans' output window?
According to this
https://netbeans.org/bugzilla/show_bug.cgi?id=214546
it should work, but it doesn't in my current Netbeans 8.0.1 installation (neither Linux nor Windows).
Any hints on how to do that?
I am using Netbeans 8.0.1 myself, on Windows 7. I just tried ANSI escape code, and it works. Example:
String greenBold = "\033[32;1m";
String reset = "\033[0m";
System.out.println("before" + greenBold + " green " + reset + "after");
There seems to be a problem when using Maven 3.5.x.
See:
https://netbeans.org/bugzilla/show_bug.cgi?id=270593
https://github.com/fusesource/jansi/issues/87
I tried NB 8.2 with the old Maven 3.3.9 first and it worked fine out of the box. The whole output remained as it had been but my application's own logs were colored as expected.
With Maven 3.5.2 and 3.5.4 the colors didn't work at all. So I had to set MAVEN_OPTS environment variable to "-Djansi.passthrough=true" (as suggested in the first link) and restart NetBeans. The problem is that now the whole output is colored differently and error stack traces don't contain links to code any more. So I'm switching back.
BTW. When using log4j2's %highlight{}, I also had to set disableAnsi="false" to get the desired effect:
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} %highlight{%-5level} [%t] %location --- %msg%n%throwable" disableAnsi="false" />
</Console>
I'm using NetBeans 12.3 and I had same problem. Problem is with bundled Maven (version 3.6.3).
When I changed to Maven which I installed on my system it works. Note that version of Maven installed on my system is the same as the bundled one - 3.6.3.
I have changed location of Maven in settings:
#YoungFrog solution was the best for me.
I spent all day to get NetBeans 14 working with hyperlinks and ANSI colors simultaneosly.
chmod -r /path/to/netbeans-14/netbeans/java/maven/lib/jansi*
did the job.
Actually, for me it was bad to change the default maven installation folder. In order to have all the output correctly working (hyperlinks in stack trace, ANSI colors in output, no NETBEANS-EXEC lines) I suggest you to use the one bundled with the specific NetBeans version you have installed.

Netbeans 7.01 with Cygwin, debugger won't stop on breakpoints

I presume that the debugger is configured correctly (but what else can it be)?
If I look at Tools/Options/C/C++ it is set up nicely for Cygwin_4.x and the toolset programs all exist (especially C:\cygwin\bin\gdb.exe) Since I can build and link ok, and this all gets setup by NetBeans discovery of the toolset, I would expect to be able to debug.
The only minor detail is that C:\users\mawg.gdbinit does not exist. I supplied an empty file to no avail. IIRC from form running GDB by hand 20 years ago it isn't necessary.
If I Ctrl+F5 (debug main project (I have only one)) or Alt+F6 (run all test files) the application runs and produces output ... I can also "step into" and proceed with F7 & F8 ...
... but it won't stop on breakpoints.
I guess that I am missing something very simple. Who can point it out to me, please? Thanks
OK, I could just delete this question, but I will post the "answer" just so others might have one more thing to check if they have the same problem.
Not being able to debug with Netbans, I tried MS visual studio and it reported that I had an opening
#ifdef __cplusplus
extern "C" {
#endif
without the corresponding close.
This is not a NetBeans problem; it is a GCC compiler problem, from GCC of Cygwin, I will report this to GNU/GCC.
Moral: migh be worth checking; but it is always worth running problematic code through a few different compilers and linters.

Using Haml & Sass with Eclipse

Are there any plugins for eclipse that add syntax highlighting and other niceties for editing Haml and Sass? Google searches only seem to point to a dead project on lucky-dip.net.
Note: it's Sass I'm most interested in. A solution for using just Sass (or something similar to it like less) in Eclipse would suit my needs.
Also, I'm developing for Google App Engine (Java), using the App Engine plugin for Eclipse. So switching to another IDE isn't an option.
Update: So I've got syntax highlighting now using Pascal's answer and I've installed Ruby and Compass to compile sass into css.
However I'm aware that the syntax of sass will be changing with 2.4 so I'd still like to get the Haml and Sass Editors that come with Aptana to work. When I tried to use them they threw an exception and wouldn't display the files. I'd be interested to know if that's because I misconfigured Aptana or is an actual bug in the editors.
I'd also be very interested in any way of compiling Sass that integrated with Ecplise so that I didn't have to run something separate from it. (or a way of putting Sass/Compass in the Ecplise build process.)
Well, what about Aptana? According to the Haml/Saas Syntax Highlighting in Aptana/Eclipse blog post:
Recently, I have been using Haml in
some my Rails projects. It simply
makes your views clean and readable.
One issue I had was syntax
highlighting in my favorite IDE,
Aptana Studio. The Haml syntax
highlighting support has been stopped
a while ago and more issues have
raised after Aptana recent updates.
After some research, I found a
solution posted by Max Kostovetski, a
member of Haml Google group. Now, to
the steps:
Download the following files to your hard drive:>
http://haml.googlegroups.com/web/haml_lexer.lxr
http://haml.googlegroups.com/web/haml.col
http://haml.googlegroups.com/web/sass_lexer.lxr
http://haml.googlegroups.com/web/sass.col
From AptanaEclipse "Window" menu, select "Preferences..."
In the the preferences window, select "Editors" > "Generic Text"
Press "Add..." to add new file extensions: *.haml and *.sass
For each of the new extensions, click it and press "Browse..." to
select the proper lexer file (*.lxr)
For colorization, press "Import..." to import the *.col files
Press "OK"
Enjoy you Haml views
PS: Refer to the original blog post as it provides up-to-date links.
Note: this can be used with the Aptana RadRails Eclipse plugin as well as Aptana Studio
UPDATE: At the time of writing, RadRails and Studio seems to support Haml and Sass so it might now be unnecessary to follow the steps above.
To compile SaaS in an "integrated" way inside Eclipse, you could maybe just use an External Tool (Run > External Tools). Another more elaborated option would be to add a "Program Builder" to your project's Builders like in this blog post. Of course, the described solution would require to be adapted to Saas but the principles behind it seems to apply. Caution: I didn't implement it myself, it's just an idea and I'm not even sure it makes sense.
Notice that latest EclipseColorer actually supports both HAML&SASS. It may be a good alternative choice if you don't need a full featured Aptana IDE, but just looking for an editor.
EclipseColorer also gives you better syntax mixin support: other languages inside of HAML are highlighted with respect of their syntax (mixins for ruby, javascript, css, even sass).
While it doesn't appear that there are any HAML or SASS syntax highlighters yet, you may want to consider doing something along the lines of bringing VIM (which does have support for HAML syntax highlighting) into Eclipse via a few available plugins. Eclim might be a possibility (although, I have not used it - just trying to offer other alternatives).
Another options is to take an already existing Eclipse syntax highlighting plug-in and add syntax highlighting for Sass and/or HAML. Something like the Eclipse Colorer may be worth looking into.
I know this is an old question, but for anyone new to SASS aond Compass like me, I just installed Aptana Studio 3 and it now has support for .scss, .sass, and .haml. Enjoy.
Aptana causes too many problems for me, so after lots of searching (which turned up this thread), I found
LiClipseText (https://marketplace.eclipse.org/content/liclipsetext)
It is a plugin that provides, amongst other things, syntax highlighting for SASS/SCSS files. It seems to work, and has "Syntax Highlighting (LiClipse, TextMate or SublimeText based)" so is probably quite configurable (I have not played around with it much, but the basic syntax highlighting feature is working for me, which is more than the Eclipse WST CSS editor could do for SCSS files).
It is the open-sourced editor component of the commercial LiClipse plugin (https://marketplace.eclipse.org/content/liclipse) which I have not used.
I found Colorer plugin in Igor's answer interesting, yet I use .scss file extention and it only works for .sass files. Here's how to make it support .scss file extension:
First install the plugin as normal. Select Install New software in Help menu in Eclipse and add the following repository: http://colorer.sf.net/eclipsecolorer. Now select this repository and you should see the Eclipse Colorer install option. There is no drag-install option AFAIK.
After install, goto Colorer plugin folder inside Eclipse's plugin directory. In my case that's eclipse/plugins/net.sf.colorer_0.9.9/. There you'll have to modify 3 files:
colorer/hrc/common.jar
colorer/hrc/proto.hrc
/plugin.xml
Before doing any of the below instruction, please backup all files in the folder in order to restore them if anything goes wrong.
Modifying common.jar
Extract common.jar to an empty folder. This is done as any normal tar.gz file. Once extracted you'll have to modify 2 files in it:
duplicate lines 53 and 53 in inet/haml.hrc and change it to scss. The result should be like below:
<block start='/^((\s\s)*):(sass)/' end='/^\M (\s*$|\y1\s)?! /ix' region='def:Insertion' region01='def:Outlined'
region00='def:PairStart' region10='def:PairEnd' content-priority='low' scheme='sass:sass'/>
<block start='/^((\s\s)*):(scss)/' end='/^\M (\s*$|\y1\s)?! /ix' region='def:Insertion' region01='def:Outlined'
region00='def:PairStart' region10='def:PairEnd' content-priority='low' scheme='scss:scss'/>
now copy inet/sass.hrc to inet/scss.hrc and change the relevant lines. The resulting scss.hrc should be like below:
<?xml version="1.0" encoding='Windows-1251'?>
<!DOCTYPE hrc PUBLIC "-//Cail Lomecb//DTD Colorer HRC take5//EN"
"http://colorer.sf.net/2003/hrc.dtd">
<hrc version="take5" xmlns="http://colorer.sf.net/2003/hrc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://colorer.sf.net/2003/hrc http://colorer.sf.net/2003/hrc.xsd">
<type name="scss">
<annotation>
<documentation>
SCSS Sassy CSS
</documentation>
<contributors><![CDATA[
Igor Russkih irusskih at gmail dot com
]]></contributors>
</annotation>
<region name="ClassSelector" parent="def:TypeKeyword"/>
<region name="IDSelector" parent="def:Keyword"/>
<region name="IncludeMixin" parent="def:Label"/>
<scheme name='PropertyNames'>
<regexp match="/(\$)([\w\d\-]+)/" region='def:Var'/>
<inherit scheme='css:PropertyNames'/>
</scheme>
<scheme name="PropertyWrapper">
<block start="/~/" end="/(:|\s|$)/" scheme="PropertyNames" region10="def:Symbol"/>
<regexp match="/(\$)([\w\d\-]+)/" region='def:Var'/>
<inherit scheme="css:Property"/>
</scheme>
<scheme name="scss">
<!-- property value after colon -->
<block start="/\M([\$\w\d\-]+)\s*(:)/" end="/\M([\x22\x27]|$)/"
scheme="PropertyWrapper" region02="def:Symbol"
/>
<block start="/(:)\s*\M([\w\d\-]+)?/" end="/\M([\x22\x27]|$)/"
scheme="PropertyWrapper" region02="def:Symbol"
/>
<regexp match="/^ \s* \M[\.\#\=\#\!] (?{def:Outlined}[\w\d\-]+ ) /x" />
<regexp match="/ \. (?{ClassSelector}[\w\d\-]+ ) /x" />
<regexp match="/ \# (?{IDSelector}[\w\d\-]+ ) /x" />
<regexp match="/ [\=\+] (?{IncludeMixin}[\w\d\-]+ ) /x" />
<regexp match="/[\(\)&apos;"]/" region='def:Symbol'/>
<regexp match="/\/\/.*$/" region='def:Comment'/>
<regexp match="/\#(import|extend|mixin)/" region='def:Keyword'/>
</scheme>
</type>
</hrc>
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is the Colorer Library.
-
- The Initial Developer of the Original Code is
- Igor Russkih <irusskih at gmail dot com>
- Portions created by the Initial Developer are Copyright (C) 2010
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
after this, run the following command in the folder where you extract common.jar to recreate the jar file:
jar cf common.jar *
then substitute the original jar file by this one.
Other files
Now, include scss extension in /plugin.xml line 37:
extensions="xml,xsd,xsl,dtd,hrc,hrd,html,htm,xhtml,rhtml,erb,yml,haml,sass,scss,css,asp,aspx,jsp,fo,svg,dbk,docbook,jhtml,jspf,php,php3,php4,phtml,sgm,sgml,shtm,shtml"
And finally, duplicate lines 200-203 in colorer/hrc/proto.hrc. The result should be like below:
<prototype name="sass" group="inet" description="SASS">
<location link="jar:common.jar!inet/sass.hrc"/>
<filename>/\.(sass)$/i</filename>
</prototype>
<prototype name="scss" group="inet" description="SCSS">
<location link="jar:common.jar!inet/scss.hrc"/>
<filename>/\.(scss)$/i</filename>
</prototype>
After this restart eclipse and you should have syntax highlighting for .scss files.

Is is possible to compile projects with "IDE-Managed Components" through the command line?

I've been trying to build some huge projects in BCB5 for some time now. I want to use the command line tools because it would cut build time by more than 50% (it already takes 4 hours in the IDE). Often, projects will build just fine in the IDE but fail miserably in the command line. I did some digging and discovered this nice little comment in a header file:
__published: // IDE-managed Components
Is this saying that the components that follow can only be built with the IDE open? Please tell me there is a way around this. BCB5 is starting to make me depressed.
Extra info:
Make.exe gives a pile of errors claiming ambiguity between the header file and an imported file. I''m pretty sure the header file is supposed to be referencing the imported file though, rather than comparing with it.
In the header file:
#include <ComCtrls.hpp>
ComCtrls.hpp has the variable TTreeNode.
Error from make:
[exec] Error E2015 .\TMain.h 876: Ambiguity between 'TTreeNode' and 'Comctrls::TTreeNode'
__published: // IDE-managed Components Is this saying that the
components that follow can only be
built with the IDE open? Please tell
me there is a way around this. BCB5 is
starting to make me depressed.
No, this does not mean that you can only build the source in the IDE. It just means that this section is automatically populated by the IDE (the form designer)
While there are good third party solutions (as mentioned by the others) C++Builder 2007 and above made huge improvements in the build system. IDE build times are very similar to command line builds and the MSBuild integration now makes it possible to be sure that the same parameters are passed to the command line tools as are used by the IDE.
Have you tried installing the C++ Compiler Enhancements plugin, by Andreas Hausladen, which improves the compilation speed. I would also recommend installing the DelphiSpeedUp plugin.
I think you need to export the project as makefile, to compile from the command line, because C++Builder 5 project files are XML. Have a look at this article, from the C++Builder Developer's Journal.
If none of the above fails try the official C++Builder Forum.
I've more or less given up on the BCB5 command line tools. It appears that they are fundamentally broken.
I did, however, manage to find a nice open source tool, ProjectMaker, that uses the command line tools effectively. You can find it here: http://projectmaker.jomitech.com.
ProjectMaker fixes up a few of the problems with BPR2MAK, but it's not perfect. Most project build perfectly with ProjectMaker, some still require the IDE. It's not a perfect solution, but it does alright.