You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Hendrik Maryns <qw...@sneakemail.com> on 2008/10/17 15:36:34 UTC

[CLI] Building Commons CLI

Hi,

I have downloaded and edited Commons CLI.  It works fine after some
configuring in Eclipse.  Building from the command line, however, fails,
both with Ant and with Maven.

Ok, that is not entirely true: ant dist works in that it produces a jar,
but:
junit-present:
     [echo] ================================= WARNING
================================
     [echo] Junit isn't present in your ${ANT_HOME}/lib directory. Tests
not executed.
     [echo]
==========================================================================

I tried putting junit.jar into /usr/share/ant/lib, but it still gives
this error.  What can I do to get it to do the tests?

Maven is more problematic.  The README says to do mvn jar:jar.  Well,
this has failed with a lot of different messages, the latest one is:

> mvn jar:jar
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'jar'.
[INFO]
------------------------------------------------------------------------
[INFO] Building Commons CLI
[INFO]    task-segment: [jar:jar]
[INFO]
------------------------------------------------------------------------
[INFO] [jar:jar]
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Error assembling JAR

Embedded error: Manifest file: /home/hendrik/workspace/Jakarta
CLI/target/osgi/MANIFEST.MF does not exist.
[INFO]
------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Fri Oct 17 15:33:50 CEST 2008
[INFO] Final Memory: 10M/151M
[INFO]
------------------------------------------------------------------------

If I try to do the default mvn clean install it starts out fine, but
complains about generics, which is obvious, because it gives javac the
switch -source 1.3!!

Since I generified CLI, obviously I want to use -source 1.5 (and
actually, for now, I wouldn’t bother with -source at all and get it
compiling under the latest Java).

Some recommendations mostly welcome.  Once the tests run, I can start
submitting patches.

H.
-- 
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html


Re: [CLI] Building Commons CLI

Posted by Hendrik Maryns <qw...@sneakemail.com>.
Stefan Bodewig schreef:
> On Fri, 17 Oct 2008, Hendrik Maryns <qw...@sneakemail.com> wrote:
> 
>>> ant -diagnostics
>> ------- Ant diagnostics report -------
>> Apache Ant version 1.7.0 compiled on June 7 2008
>>
>> -------------------------------------------
>>  Implementation Version
>> -------------------------------------------
>> core tasks     : 1.7.0
>> optional tasks : not available
> 
> This means you don't have any optional tasks installed, which means no
> JUnit task at all.

That  was the problem , installing ant-junit did the trick.

Thanks all.
H.
-- 
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html


Re: [CLI] Building Commons CLI

Posted by Stefan Bodewig <bo...@apache.org>.
On Fri, 17 Oct 2008, Hendrik Maryns <qw...@sneakemail.com> wrote:

>> ant -diagnostics
> ------- Ant diagnostics report -------
> Apache Ant version 1.7.0 compiled on June 7 2008
> 
> -------------------------------------------
>  Implementation Version
> -------------------------------------------
> core tasks     : 1.7.0
> optional tasks : not available

This means you don't have any optional tasks installed, which means no
JUnit task at all.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [CLI] Building Commons CLI

Posted by Hendrik Maryns <qw...@sneakemail.com>.
Simon Kitching schreef:
> Jörg Schaible schrieb:
>> Hi Hendrik,
>>
>> Hendrik Maryns wrote:
>>  
>>> Hi,
>>>
>>> I have downloaded and edited Commons CLI.  It works fine after some
>>> configuring in Eclipse.  Building from the command line,
>>> however, fails,
>>> both with Ant and with Maven.
>>>
>>> Ok, that is not entirely true: ant dist works in that it
>>> produces a jar,
>>> but:
>>> junit-present:
>>>      [echo] ================================= WARNING
>>> ================================
>>>      [echo] Junit isn't present in your ${ANT_HOME}/lib
>>> directory. Tests
>>> not executed.
>>>      [echo]
>>> ==============================================================
>>> ============
>>> I tried putting junit.jar into /usr/share/ant/lib, but it still gives
>>> this error.  What can I do to get it to do the tests?
>>>     
> I think this should have worked. Ant *does* require junit to be added to
> its lib dir. Maybe you have multiple copies of ant?
> And there are multiple versions of junit too; I would try junit-3.8.x,
> not the 4.x series.

I have
> ant -diagnostics
------- Ant diagnostics report -------
Apache Ant version 1.7.0 compiled on June 7 2008

-------------------------------------------
 Implementation Version
-------------------------------------------
core tasks     : 1.7.0
optional tasks : not available

-------------------------------------------
 ANT PROPERTIES
-------------------------------------------
ant.version: Apache Ant version 1.7.0 compiled on June 7 2008
ant.java.version: 1.6
ant.core.lib: /usr/share/java/ant-1.7.0.jar
ant.home: /usr/share/ant

I suppose ANT_HOME is the same as ant.home: /usr/share/ant, and the lib
dir contains:

> l /usr/share/ant/lib/
<snip>
lrwxrwxrwx 1 root root     20 2008-10-16 13:42 junit.jar ->
../../java/junit.jar

~> l /usr/share/java/junit.jar
lrwxrwxrwx 1 root root 15 2008-06-24 17:03 /usr/share/java/junit.jar ->
junit-3.8.1.jar

I even tried copying junit-3.8.1.jar into /usr/share/ant/lib explicitly,
but still no luck.

>>> Maven is more problematic.  The README says to do mvn jar:jar.      
>>
>> Really? Either call with Maven 1 "maven jar:jar" or with Maven 2 "mvn
>> install". But maybe it's time to get rid of M1 entirely as supported
>> build system.
>>   
> +1 on ditching maven 1.x builds. It was never hugely popular and is a
> pain to maintain.
>>> ----------
>>>
>>> If I try to do the default mvn clean install it starts out fine, but
>>> complains about generics, which is obvious, because it gives javac
>>> the switch -source 1.3!!     
>>
>> This is the default for Maven. You have to configure the compiler (and
>> javadoc) plugin to use 1.5 as source and target. We might add this in
>> an profile of the parent POM that is activated if JDK 5 is used.
>>   
> Making the source/target setting depend on the current jvm would defeat
> the purpose. The point that CLI is currently intended to support the 1.3
> JVM, so obviously it is *good* for error to be reported if some
> developer accidentally uses a java-1.5 feature, regardless of what
> compiler they do the build with.

Well, that will be my next rfe: upgrade CLI to use java 5 features.
Hey, Java 5 is already end-of-life!

> Hendrik, to enable java1.5 the magic configuration needed for maven 2.x is:
> 
>  <build>
>    <plugins>
>      <plugin>
>        <artifactId>maven-compiler-plugin</artifactId>
>        <version>2.0.2</version>
>        <configuration>
>          <source>1.5</source>
>          <target>1.5</target>
>        </configuration>
>      </plugin>

I am really new to Maven, where do I put this?

H.
-- 
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html


Re: [CLI] Building Commons CLI

Posted by Simon Kitching <sk...@apache.org>.
Jörg Schaible schrieb:
> Hi Hendrik,
>
> Hendrik Maryns wrote:
>   
>> Hi,
>>
>> I have downloaded and edited Commons CLI.  It works fine after some
>> configuring in Eclipse.  Building from the command line,
>> however, fails,
>> both with Ant and with Maven.
>>
>> Ok, that is not entirely true: ant dist works in that it
>> produces a jar,
>> but:
>> junit-present:
>>      [echo] ================================= WARNING
>> ================================
>>      [echo] Junit isn't present in your ${ANT_HOME}/lib
>> directory. Tests
>> not executed.
>>      [echo]
>> ==============================================================
>> ============ 
>>
>> I tried putting junit.jar into /usr/share/ant/lib, but it still gives
>> this error.  What can I do to get it to do the tests?
>>     
I think this should have worked. Ant *does* require junit to be added to 
its lib dir. Maybe you have multiple copies of ant?
And there are multiple versions of junit too; I would try junit-3.8.x, 
not the 4.x series.

>> Maven is more problematic.  The README says to do mvn jar:jar.  
>>     
>
> Really? Either call with Maven 1 "maven jar:jar" or with Maven 2 "mvn install". But maybe it's time to get rid of M1 entirely as supported build system.
>   
+1 on ditching maven 1.x builds. It was never hugely popular and is a 
pain to maintain.
>> ----------
>>
>> If I try to do the default mvn clean install it starts out fine, but
>> complains about generics, which is obvious, because it gives javac
>> the switch -source 1.3!! 
>>     
>
> This is the default for Maven. You have to configure the compiler (and javadoc) plugin to use 1.5 as source and target. We might add this in an profile of the parent POM that is activated if JDK 5 is used.
>   
Making the source/target setting depend on the current jvm would defeat 
the purpose. The point that CLI is currently intended to support the 1.3 
JVM, so obviously it is *good* for error to be reported if some 
developer accidentally uses a java-1.5 feature, regardless of what 
compiler they do the build with.

Hendrik, to enable java1.5 the magic configuration needed for maven 2.x is:

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.0.2</version>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>

Regards,
Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [CLI] Building Commons CLI

Posted by Hendrik Maryns <qw...@sneakemail.com>.
Emmanuel Bourg schreef:
> Hendrik Maryns a écrit :
> 
>> I guess I’ll update the README file for a starters, and I hope some
>> other CLI developers are reading this, so that this can be fixed.
> 
> Done, I removed the old Maven 1 files and updated the README. I fixed
> also some test errors with Maven 2.

And indeed it builds with mvn now for me, thanks for that.

H.
-- 
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html


Re: [CLI] Building Commons CLI

Posted by Emmanuel Bourg <eb...@apache.org>.
Hendrik Maryns a écrit :

> I guess I’ll update the README file for a starters, and I hope some
> other CLI developers are reading this, so that this can be fixed.

Done, I removed the old Maven 1 files and updated the README. I fixed 
also some test errors with Maven 2.

Emmanuel Bourg

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [CLI] Building Commons CLI

Posted by Hendrik Maryns <qw...@sneakemail.com>.
Jörg Schaible schreef:
> Hi Hendrik,
> 
> Hendrik Maryns wrote:
>> Hi,
>>
>> I have downloaded and edited Commons CLI.  It works fine after some
>> configuring in Eclipse.  Building from the command line,
>> however, fails,
>> both with Ant and with Maven.
<snip>
>> Maven is more problematic.  The README says to do mvn jar:jar.  
> 
> Really? Either call with Maven 1 "maven jar:jar" or with Maven 2 "mvn install". But maybe it's time to get rid of M1 entirely as supported build system.

I guess I’ll update the README file for a starters, and I hope some
other CLI developers are reading this, so that this can be fixed.

>> If I try to do the default mvn clean install it starts out fine, but
>> complains about generics, which is obvious, because it gives javac
>> the switch -source 1.3!! 
> 
> This is the default for Maven. You have to configure the compiler (and javadoc) plugin to use 1.5 as source and target. We might add this in an profile of the parent POM that is activated if JDK 5 is used.

Thanks, how do I do this?

-- 
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html


RE: [CLI] Building Commons CLI

Posted by Jörg Schaible <Jo...@scalaris.com>.
Hi Hendrik,

Hendrik Maryns wrote:
> Hi,
> 
> I have downloaded and edited Commons CLI.  It works fine after some
> configuring in Eclipse.  Building from the command line,
> however, fails,
> both with Ant and with Maven.
> 
> Ok, that is not entirely true: ant dist works in that it
> produces a jar,
> but:
> junit-present:
>      [echo] ================================= WARNING
> ================================
>      [echo] Junit isn't present in your ${ANT_HOME}/lib
> directory. Tests
> not executed.
>      [echo]
> ==============================================================
> ============ 
> 
> I tried putting junit.jar into /usr/share/ant/lib, but it still gives
> this error.  What can I do to get it to do the tests?
> 
> Maven is more problematic.  The README says to do mvn jar:jar.  

Really? Either call with Maven 1 "maven jar:jar" or with Maven 2 "mvn install". But maybe it's time to get rid of M1 entirely as supported build system.

> Well,
> this has failed with a lot of different messages, the latest one is:
> 
>> mvn jar:jar
> [INFO] Scanning for projects...
> [INFO] Searching repository for plugin with prefix: 'jar'. [INFO]
> --------------------------------------------------------------
> ----------
> [INFO] Building Commons CLI
> [INFO]    task-segment: [jar:jar]
> [INFO]
> --------------------------------------------------------------
> ----------
> [INFO] [jar:jar]
> [INFO]
> --------------------------------------------------------------
> ----------
> [ERROR] BUILD ERROR
> [INFO]
> --------------------------------------------------------------
> ----------
> [INFO] Error assembling JAR
> 
> Embedded error: Manifest file: /home/hendrik/workspace/Jakarta
> CLI/target/osgi/MANIFEST.MF does not exist.
> [INFO]
> --------------------------------------------------------------
> ----------
> [INFO] For more information, run Maven with the -e switch [INFO]
> --------------------------------------------------------------
> ----------
> [INFO] Total time: 2 seconds
> [INFO] Finished at: Fri Oct 17 15:33:50 CEST 2008
> [INFO] Final Memory: 10M/151M
> [INFO]
> --------------------------------------------------------------
> ----------
> 
> If I try to do the default mvn clean install it starts out fine, but
> complains about generics, which is obvious, because it gives javac
> the switch -source 1.3!! 

This is the default for Maven. You have to configure the compiler (and javadoc) plugin to use 1.5 as source and target. We might add this in an profile of the parent POM that is activated if JDK 5 is used.

> Since I generified CLI, obviously I want to use -source 1.5 (and
> actually, for now, I wouldn't bother with -source at all and get it
> compiling under the latest Java).
> 
> Some recommendations mostly welcome.  Once the tests run, I can start
> submitting patches. 
> 
> H.

- Jörg

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org