there is already the maven goal to make formatting - jalopy:format but it compiles and then formats the whole project. If you want to format just one or a set of files you can add to your maven-jalopy-plugin-1.2 that comes with maven rc2 the following goal
<goal name="jalopy:formatfile"
description="Format all sources with code convention conformance"
prereqs="jalopy:taskdef, java:compile">
<ant:path id="project.classpath">
<ant:path refid="maven.dependency.classpath"/>
<ant:pathelement path="${maven.build.dest}"/>
</ant:path> <ant:jalopy fileformat="${maven.jalopy.fileFormat}"
style="${maven.jalopy.style}"
history="${maven.jalopy.history}"
loglevel="${maven.jalopy.logLevel}"
failonerror="${maven.jalopy.failOnError}"
threads="${maven.jalopy.nbThread}"
classpathref="project.classpath">
<ant:fileset dir="${format.dir}">
<ant:include name="${format.file}" />
</ant:fileset>
</ant:jalopy>
</goal>then you can specify -Dformat.dir and -Dformat.file as maven options.
The only problem that it will use maven project formatting that is specified by jalopy_maven.xml in plugin-resources. Although if the problem is only in brackets and tabs then you can remove all except whitespace and indentation tags. They contain normal Apache formatting definitions.
Regards, Kostya
Eric Pugh wrote:
Any chance of converting this to a Maven goal that could be called? I don't have perl installed.. Is there a java equvalent?
ERic
-----Original Message----- From: Jeffery Painter [mailto:[EMAIL PROTECTED] Sent: Thursday, May 13, 2004 5:38 PM To: Turbine Developers List Subject: Re: cvs commit: jakarta-turbine-2/src/java/org/apache/turbine/services/intake IntakeTool.java
On Thu, 13 May 2004, Angelo Turetta wrote:
- for (int i = 0; i < groupKeys.length; i++) - { - if (!groupKeys[i].equals(group.getGID())) - { - pp.add(INTAKE_GRP, groupKeys[i]); + if (groupKeys != null) + { + for (int i = 0; i < groupKeys.length; i++) + {
This formatting normally means the new lines are TAB-indented instead of SPACE-indented
Angelo.
In case anyone needs this, I got tired of dealing with tabs, so I wrote a perl script to convert to spaces which is nice to run against your code before checking it in.
I usually just run
find ./ -name "*.java" -exec notab.pl {} \;
and cleans up all the tabs.
Jeff Painter
--------------------------------------------------------------- #!/usr/bin/perl -w # notab.pl
## [EMAIL PROTECTED] ## source file converter ## replace tabs with (4) space characters
# setup tab characters my $tab = "\t"; my $spaced_tab = " ";
my $srcFile = $ARGV[0]; print "Converting tab stops for file: " . $srcFile . "\n";
# read in the source file and strip the created tag open( SRC_FILE, $srcFile ); while ( $line = <SRC_FILE> ) { $src .= $line; } close( SRC_FILE );
# do the conversion $src =~ s/$tab/$spaced_tab/g;
# write updated source file out to disk open( OUT_SRC, ">$srcFile"); print OUT_SRC $src; close(OUT_SRC);
exit 0;
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
