You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by levko <le...@yahoo.com> on 2009/08/07 00:11:31 UTC

Running iPOJO ant task in Eclipse

I run iPOJO ant task in Eclipse to manipulate Manifest file and annotated
classes of my iPOJO powered bundle project. Everything works fine if I use
bnd to create a bundle.jar from all the classes and the Manifest, then run
the ant task to manipulate the bundle.jar, then unjar this bundle.jar back
to the bin directory and copy Manifest to its natural location.

However, http://felix.apache.org/site/ipojo-ant-task.html describes more
attractive procedure for directory manipulation that does not require
creating a bundle.jar, etc. I tried this method in my ant file, using the
bin directory (where the classes are) as the 'dir' parameter value and
specifying Manifest and metadata files:
<project name="My iPOJO Bundle" default="manipulate" basedir=".">
	<property name="src.dir" value="src"/>
	<property name="lib.dir" value="../Apache-iPOJO-Platform/lib"/>
	<property name="build.dir" value="bin"/>

	<taskdef name="ipojo"
classpath="${lib.dir}/org.apache.felix.ipojo.ant-1.4.0.jar"
		     classname="org.apache.felix.ipojo.task.IPojoTask"/>
	
	<target name="manipulate">       
		<ipojo 
			dir="${build.dir}" 
			metadata="metadata.xml" 
			manifest="META-INF/MANIFEST.MF" 
		/> 
	</target> 
</project>

The ant task failed with a message like this:
[ipojo] The component ....class is declared but not in the bundle

Is something wrong with the ant file? 

Thanks,
-- Lev
-- 
View this message in context: http://www.nabble.com/Running-iPOJO-ant-task-in-Eclipse-tp24855448p24855448.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Running iPOJO ant task in Eclipse

Posted by clement escoffier <cl...@gmail.com>.
Hi,

I found anf xi the issue. It was the FELIX-1411 (directory manipulation
failed on windows). I also fixed the strange bundle name when using the
'package' target (this was just a typo...)

So, I just redeployed a new archive of the Eclipse project working on
windows. I tested it on a freshly installed Windows Vista with Eclipse
Galileo.

Regards,

Clement


2009/8/9 clement escoffier <cl...@gmail.com>

> Hum, interesting. I will check on Windows (I use a mac). It  is potentially
> this issue : https://cwiki.apache.org/jira/browse/FELIX-1411.
>
> I keep you posted.
>
> Regards,
>
> Clement
>
> 2009/8/8 levko <le...@yahoo.com>
>
>
>> Hi Clement,
>>
>>
>> clement escoffier wrote:
>> >
>> > The eclipse builder uses the 'manipulate' target. (Project Properties -
>> > Builders - MyiPOJOBundle - targets). So, it manipulates classes
>> generated
>> > by
>> > eclipse and updates the manifest everytime you change something in your
>> > project. You don't need to call ant yourself, Eclipse does that for you.
>> > ...
>> >
>> Unfortunately, it does not work for me. To make clean experiment, I
>> installed fresh version of Eclipse JEE 3.5.0 in 2 different machines (Win
>> XP
>> and Win Vista). After installing Eclipse, I imported the MyiPOJOBundle
>> project from MyiPOJOBundle-1.4.0.zip file. Then, I set the
>> MyiPOJOBundle.target as the active target platform. However, when I force
>> Eclipse to rebuild the project, the last builder (My iPOJO Bundle) fails
>> with the following log:
>> Buildfile: ...\MyiPOJOBundle\build.xml
>>
>> manipulate:
>>       [ipojo] Input directory : ...\MyiPOJOBundle\bin
>>       [ipojo] Metadata file : ...\MyiPOJOBundle\metadata.xml
>>        [ipojo] Start manipulation
>>       [ipojo] The component
>> org/apache/felix/ipojo/sample/MyComponentImpl.class is declared but not in
>> the bundle
>>
>> BUILD FAILED
>> ...\MyiPOJOBundle\build.xml:54: The component
>> org/apache/felix/ipojo/sample/MyComponentImpl.class is declared but not in
>> the bundle
>>
>> Total time: 285 milliseconds
>>
>>
>> clement escoffier wrote:
>> >
>> > So if you want to launch Ant manually, without the Eclipse compiled
>> > classes,
>> > launch 'ant compile package'. If you want to reuse compiled classes
>> (from
>> > Eclipse), check that classes are already compiled (in the Eclipse output
>> > folder (bin by default)) and then launch 'ant package'. ...
>> >
>> I also tried to launch Ant manually from the command prompt by using the
>> full set of targets (BTW, the build.xml file has error in the 'package'
>> target - the misspelled ${bunde.name} should actually be
>> ${bundle.name}.jar):
>> > ant clean compile package manipulate
>> Buildfile: build.xml
>>
>> clean:
>>
>> clean:
>>
>> compile:
>>    [mkdir] Created dir: ...\MyiPOJOBundle-1.4.0\bin
>>    [javac] Compiling 1 source file to ...\MyiPOJOBundle-1.4.0\bin
>>
>> package:
>>      [jar] Building jar: ...\MyiPOJOBundle-1.4.0\MyiPOJOBundle.jar
>>    [ipojo] Input bundle file : ...\MyiPOJOBundle-1.4.0\MyiPOJOBundle.jar
>>     [ipojo] Metadata file : ...\MyiPOJOBundle-1.4.0\metadata.xml
>>    [ipojo] Start manipulation
>>     [ipojo] Bundle manipulation - SUCCESS
>>    [ipojo] Output file : ...\MyiPOJOBundle-1.4.0\MyiPOJOBundle.jar
>>
>> manipulate:
>>    [ipojo] Input directory : ...\MyiPOJOBundle-1.4.0\bin
>>    [ipojo] Metadata file : ...\MyiPOJOBundle-1.4.0\metadata.xml
>>    [ipojo] Start manipulation
>>    [ipojo] The component
>> org/apache/felix/ipojo/sample/MyComponentImpl.class is declared but not in
>> the bundle
>>
>> BUILD FAILED
>> ...\MyiPOJOBundle-1.4.0\build.xml:54: The component
>> org/apache/felix/ipojo/sample/MyCompo
>> nentImpl.class is declared but not in the bundle
>>
>> Total time: 1 second
>>
>> So, I could not run the 'manipulate' target in both Eclipse and command
>> prompt.
>>
>> Thanks,
>> -- Lev
>> --
>> View this message in context:
>> http://www.nabble.com/Running-iPOJO-ant-task-in-Eclipse-tp24855448p24877461.html
>> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>

Re: Running iPOJO ant task in Eclipse

Posted by clement escoffier <cl...@gmail.com>.
Hum, interesting. I will check on Windows (I use a mac). It  is potentially
this issue : https://cwiki.apache.org/jira/browse/FELIX-1411.

I keep you posted.

Regards,

Clement

2009/8/8 levko <le...@yahoo.com>

>
> Hi Clement,
>
>
> clement escoffier wrote:
> >
> > The eclipse builder uses the 'manipulate' target. (Project Properties -
> > Builders - MyiPOJOBundle - targets). So, it manipulates classes generated
> > by
> > eclipse and updates the manifest everytime you change something in your
> > project. You don't need to call ant yourself, Eclipse does that for you.
> > ...
> >
> Unfortunately, it does not work for me. To make clean experiment, I
> installed fresh version of Eclipse JEE 3.5.0 in 2 different machines (Win
> XP
> and Win Vista). After installing Eclipse, I imported the MyiPOJOBundle
> project from MyiPOJOBundle-1.4.0.zip file. Then, I set the
> MyiPOJOBundle.target as the active target platform. However, when I force
> Eclipse to rebuild the project, the last builder (My iPOJO Bundle) fails
> with the following log:
> Buildfile: ...\MyiPOJOBundle\build.xml
>
> manipulate:
>       [ipojo] Input directory : ...\MyiPOJOBundle\bin
>       [ipojo] Metadata file : ...\MyiPOJOBundle\metadata.xml
>        [ipojo] Start manipulation
>       [ipojo] The component
> org/apache/felix/ipojo/sample/MyComponentImpl.class is declared but not in
> the bundle
>
> BUILD FAILED
> ...\MyiPOJOBundle\build.xml:54: The component
> org/apache/felix/ipojo/sample/MyComponentImpl.class is declared but not in
> the bundle
>
> Total time: 285 milliseconds
>
>
> clement escoffier wrote:
> >
> > So if you want to launch Ant manually, without the Eclipse compiled
> > classes,
> > launch 'ant compile package'. If you want to reuse compiled classes (from
> > Eclipse), check that classes are already compiled (in the Eclipse output
> > folder (bin by default)) and then launch 'ant package'. ...
> >
> I also tried to launch Ant manually from the command prompt by using the
> full set of targets (BTW, the build.xml file has error in the 'package'
> target - the misspelled ${bunde.name} should actually be
> ${bundle.name}.jar):
> > ant clean compile package manipulate
> Buildfile: build.xml
>
> clean:
>
> clean:
>
> compile:
>    [mkdir] Created dir: ...\MyiPOJOBundle-1.4.0\bin
>    [javac] Compiling 1 source file to ...\MyiPOJOBundle-1.4.0\bin
>
> package:
>      [jar] Building jar: ...\MyiPOJOBundle-1.4.0\MyiPOJOBundle.jar
>    [ipojo] Input bundle file : ...\MyiPOJOBundle-1.4.0\MyiPOJOBundle.jar
>     [ipojo] Metadata file : ...\MyiPOJOBundle-1.4.0\metadata.xml
>    [ipojo] Start manipulation
>     [ipojo] Bundle manipulation - SUCCESS
>    [ipojo] Output file : ...\MyiPOJOBundle-1.4.0\MyiPOJOBundle.jar
>
> manipulate:
>    [ipojo] Input directory : ...\MyiPOJOBundle-1.4.0\bin
>    [ipojo] Metadata file : ...\MyiPOJOBundle-1.4.0\metadata.xml
>    [ipojo] Start manipulation
>    [ipojo] The component
> org/apache/felix/ipojo/sample/MyComponentImpl.class is declared but not in
> the bundle
>
> BUILD FAILED
> ...\MyiPOJOBundle-1.4.0\build.xml:54: The component
> org/apache/felix/ipojo/sample/MyCompo
> nentImpl.class is declared but not in the bundle
>
> Total time: 1 second
>
> So, I could not run the 'manipulate' target in both Eclipse and command
> prompt.
>
> Thanks,
> -- Lev
> --
> View this message in context:
> http://www.nabble.com/Running-iPOJO-ant-task-in-Eclipse-tp24855448p24877461.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

Re: Running iPOJO ant task in Eclipse

Posted by levko <le...@yahoo.com>.
Hi Clement,


clement escoffier wrote:
> 
> The eclipse builder uses the 'manipulate' target. (Project Properties -
> Builders - MyiPOJOBundle - targets). So, it manipulates classes generated
> by
> eclipse and updates the manifest everytime you change something in your
> project. You don't need to call ant yourself, Eclipse does that for you.
> ...
> 
Unfortunately, it does not work for me. To make clean experiment, I
installed fresh version of Eclipse JEE 3.5.0 in 2 different machines (Win XP
and Win Vista). After installing Eclipse, I imported the MyiPOJOBundle
project from MyiPOJOBundle-1.4.0.zip file. Then, I set the
MyiPOJOBundle.target as the active target platform. However, when I force
Eclipse to rebuild the project, the last builder (My iPOJO Bundle) fails
with the following log:
Buildfile: ...\MyiPOJOBundle\build.xml

manipulate:
       [ipojo] Input directory : ...\MyiPOJOBundle\bin
       [ipojo] Metadata file : ...\MyiPOJOBundle\metadata.xml
       [ipojo] Start manipulation
       [ipojo] The component
org/apache/felix/ipojo/sample/MyComponentImpl.class is declared but not in
the bundle

BUILD FAILED
...\MyiPOJOBundle\build.xml:54: The component
org/apache/felix/ipojo/sample/MyComponentImpl.class is declared but not in
the bundle

Total time: 285 milliseconds


clement escoffier wrote:
> 
> So if you want to launch Ant manually, without the Eclipse compiled
> classes,
> launch 'ant compile package'. If you want to reuse compiled classes (from
> Eclipse), check that classes are already compiled (in the Eclipse output
> folder (bin by default)) and then launch 'ant package'. ...
> 
I also tried to launch Ant manually from the command prompt by using the
full set of targets (BTW, the build.xml file has error in the 'package'
target - the misspelled ${bunde.name} should actually be
${bundle.name}.jar): 
> ant clean compile package manipulate
Buildfile: build.xml

clean:

clean:

compile:
    [mkdir] Created dir: ...\MyiPOJOBundle-1.4.0\bin
    [javac] Compiling 1 source file to ...\MyiPOJOBundle-1.4.0\bin

package:
      [jar] Building jar: ...\MyiPOJOBundle-1.4.0\MyiPOJOBundle.jar
    [ipojo] Input bundle file : ...\MyiPOJOBundle-1.4.0\MyiPOJOBundle.jar
    [ipojo] Metadata file : ...\MyiPOJOBundle-1.4.0\metadata.xml
    [ipojo] Start manipulation
    [ipojo] Bundle manipulation - SUCCESS
    [ipojo] Output file : ...\MyiPOJOBundle-1.4.0\MyiPOJOBundle.jar

manipulate:
    [ipojo] Input directory : ...\MyiPOJOBundle-1.4.0\bin
    [ipojo] Metadata file : ...\MyiPOJOBundle-1.4.0\metadata.xml
    [ipojo] Start manipulation
    [ipojo] The component
org/apache/felix/ipojo/sample/MyComponentImpl.class is declared but not in
the bundle

BUILD FAILED
...\MyiPOJOBundle-1.4.0\build.xml:54: The component
org/apache/felix/ipojo/sample/MyCompo
nentImpl.class is declared but not in the bundle

Total time: 1 second

So, I could not run the 'manipulate' target in both Eclipse and command
prompt.

Thanks,
-- Lev
-- 
View this message in context: http://www.nabble.com/Running-iPOJO-ant-task-in-Eclipse-tp24855448p24877461.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Running iPOJO ant task in Eclipse

Posted by clement escoffier <cl...@gmail.com>.
Hi,


2009/8/7 levko <le...@yahoo.com>

>
> Hi Clement,
>
> Thank you for the prompt reply.
>
>
> clement escoffier wrote:
> >
> > It seems that Eclipse has not already compiled the component classes when
> > the bundle is built. You can try to close and re-open the project.
> >
> Actually, I used already working bundle built by using another iPOJO ant
> task, which manipulates bundle.jar, created from classes compiled by
> Eclipse; manipulated bundle.jar is unpackaged back to the bin folder
> replacing original classes with manipulated versions. The only target I've
> excluded from the build.xml is 'compile', since original version of classes
> is compiled by Eclipse (see also http://grakol.com/wordpress/?p=120).
> I also tried 'clean' experiment, starting from original classes compiled by
> Eclipse and original Manifest that does not contain any iPOJO stuff. The
> result is the same - build fails with messages like this:
> [ipojo] The component ....class is declared but not in the bundle
>
>
> clement escoffier wrote:
> >
> > You can also try to import the following project inside your Eclipse:
> > http://people.apache.org/~clement/ipojo/MyiPOJOBundle-1.4.0.zip<http://people.apache.org/%7Eclement/ipojo/MyiPOJOBundle-1.4.0.zip>
> >
> I looked at the build.xml file in the new version - it specifies 'package'
> as its default target and does not run the 'manipulate' target. I tried to
> change the default target to 'manipulate' and make this target depend on
> 'compile' to make sure the classes are created. As the result, the build
> fails with the following log:
> clean:
>   [delete] Deleting directory ...\MyiPOJOBundle-1.4.0\bin
> compile:
>    [mkdir] Created dir: ...\MyiPOJOBundle-1.4.0\bin
>    [javac] Compiling 1 source file to ...\MyiPOJOBundle-1.4.0\bin
> manipulate:
>    [ipojo] Input directory : ...\MyiPOJOBundle-1.4.0\bin
>    [ipojo] Metadata file : ...\MyiPOJOBundle-1.4.0\metadata.xml
>    [ipojo] Start manipulation
>    [ipojo] The component
> org/apache/felix/ipojo/sample/MyComponentImpl.class is declared but not in
> the bundle
>
> BUILD FAILED
> ...\MyiPOJOBundle-1.4.0\build.xml:54: The component
> org/apache/felix/ipojo/sample/MyComponentImpl.class is declared but not in
> the bundle
>
> Total time: 1 second
>
> Line 54 in the build.xml file is the end of iPOJO ant task in the
> 'manipulate' target.


The eclipse builder uses the 'manipulate' target. (Project Properties -
Builders - MyiPOJOBundle - targets. So, it manipulates classes generated by
eclipse and updates the manifest everytime you change something in your
project. You don't need to call ant yourself, Eclipse does that for you. The
builld.xml file specifies 'package' as the default target because it is used
(at least by me) to really generate the 'final' bundle. It can use either
classes already compiled by Eclipse ('ant package'), or can launch javac
with 'ant compile package'.

So if you want to launch Ant manually, without the Eclipse compiled classes,
launch 'ant compile package'. If you want to reuse compiled classes (from
Eclipse), check that classes are already compiled (in the Eclipse output
folder (bin by default)) and then launch 'ant package'. Last way, configure
an Ant builder (so, you don't have to launch ant manually) in your eclipse
project using the 'manipulate' target.

Regards,

Clement


>
>
> Thanks,
> -- Lev
> --
> View this message in context:
> http://www.nabble.com/Running-iPOJO-ant-task-in-Eclipse-tp24855448p24865293.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

Re: Running iPOJO ant task in Eclipse

Posted by levko <le...@yahoo.com>.
Hi Clement,

Thank you for the prompt reply.


clement escoffier wrote:
> 
> It seems that Eclipse has not already compiled the component classes when
> the bundle is built. You can try to close and re-open the project.
> 
Actually, I used already working bundle built by using another iPOJO ant
task, which manipulates bundle.jar, created from classes compiled by
Eclipse; manipulated bundle.jar is unpackaged back to the bin folder
replacing original classes with manipulated versions. The only target I've
excluded from the build.xml is 'compile', since original version of classes
is compiled by Eclipse (see also http://grakol.com/wordpress/?p=120).
I also tried 'clean' experiment, starting from original classes compiled by
Eclipse and original Manifest that does not contain any iPOJO stuff. The
result is the same - build fails with messages like this:
[ipojo] The component ....class is declared but not in the bundle


clement escoffier wrote:
> 
> You can also try to import the following project inside your Eclipse:
> http://people.apache.org/~clement/ipojo/MyiPOJOBundle-1.4.0.zip
> 
I looked at the build.xml file in the new version - it specifies 'package'
as its default target and does not run the 'manipulate' target. I tried to
change the default target to 'manipulate' and make this target depend on
'compile' to make sure the classes are created. As the result, the build
fails with the following log:
clean:
   [delete] Deleting directory ...\MyiPOJOBundle-1.4.0\bin
compile:
    [mkdir] Created dir: ...\MyiPOJOBundle-1.4.0\bin
    [javac] Compiling 1 source file to ...\MyiPOJOBundle-1.4.0\bin
manipulate:
    [ipojo] Input directory : ...\MyiPOJOBundle-1.4.0\bin
    [ipojo] Metadata file : ...\MyiPOJOBundle-1.4.0\metadata.xml
    [ipojo] Start manipulation
    [ipojo] The component
org/apache/felix/ipojo/sample/MyComponentImpl.class is declared but not in
the bundle

BUILD FAILED
...\MyiPOJOBundle-1.4.0\build.xml:54: The component
org/apache/felix/ipojo/sample/MyComponentImpl.class is declared but not in
the bundle

Total time: 1 second

Line 54 in the build.xml file is the end of iPOJO ant task in the
'manipulate' target.

Thanks,
-- Lev
-- 
View this message in context: http://www.nabble.com/Running-iPOJO-ant-task-in-Eclipse-tp24855448p24865293.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Running iPOJO ant task in Eclipse

Posted by clement escoffier <cl...@gmail.com>.
Hi,

It seems that Eclipse has not already compiled the component classes when
the bundle is built. You can try to close and re-open the project.

You can also try to import the following project inside your Eclipse:
http://people.apache.org/~clement/ipojo/MyiPOJOBundle-1.4.0.zip
It is a pre-configured project for Eclipse (ipojo 1.4.0), with the ant
builder set and the configuration for Equinox. It is the evolution of
http://felix.apache.org/site/apache-felix-ipojo-eclipse-integration.html.
(it's not yet in download from the web page because we're a validating all
tutorials and archive, it should be on the web site soon).

Regards,

Clement

2009/8/7 levko <le...@yahoo.com>

>
> I run iPOJO ant task in Eclipse to manipulate Manifest file and annotated
> classes of my iPOJO powered bundle project. Everything works fine if I use
> bnd to create a bundle.jar from all the classes and the Manifest, then run
> the ant task to manipulate the bundle.jar, then unjar this bundle.jar back
> to the bin directory and copy Manifest to its natural location.
>
> However, http://felix.apache.org/site/ipojo-ant-task.html describes more
> attractive procedure for directory manipulation that does not require
> creating a bundle.jar, etc. I tried this method in my ant file, using the
> bin directory (where the classes are) as the 'dir' parameter value and
> specifying Manifest and metadata files:
> <project name="My iPOJO Bundle" default="manipulate" basedir=".">
>        <property name="src.dir" value="src"/>
>        <property name="lib.dir" value="../Apache-iPOJO-Platform/lib"/>
>        <property name="build.dir" value="bin"/>
>
>        <taskdef name="ipojo"
> classpath="${lib.dir}/org.apache.felix.ipojo.ant-1.4.0.jar"
>                     classname="org.apache.felix.ipojo.task.IPojoTask"/>
>
>        <target name="manipulate">
>                <ipojo
>                        dir="${build.dir}"
>                        metadata="metadata.xml"
>                        manifest="META-INF/MANIFEST.MF"
>                />
>        </target>
> </project>
>
> The ant task failed with a message like this:
> [ipojo] The component ....class is declared but not in the bundle
>
> Is something wrong with the ant file?
>
> Thanks,
> -- Lev
> --
> View this message in context:
> http://www.nabble.com/Running-iPOJO-ant-task-in-Eclipse-tp24855448p24855448.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>