You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jennifer Vendetti <ve...@stanford.edu> on 2013/10/23 21:45:06 UTC

mvn-eclipse-plugin problem with pde projects and linked resources

Hello,

I just took over the maintenance of several OSGi bundles.  I added the 
mvn-eclipse-plugin to the POM files for each of the bundles because I'd 
like to generate the necessary Eclipse project files to work with the 
source code and use the OSGi Framework launcher in the Eclipse IDE:

<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<pde>true</pde>
</configuration>
</plugin>

For reasons I don't understand, running "mvn eclipse:eclipse" generates 
a .project file with an incomplete set of linked resources.  For 
example, I have a POM file for one of the bundles that has the following 
3 dependencies:

<dependency>
  <groupId>log4j</groupId>
  <artifactId>log4j</artifactId>
  <version>1.2.17</version>
  </dependency>

<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.main</artifactId>
<version>4.2.1</version>
</dependency>

<dependency>
<groupId>com.jgoodies</groupId>
<artifactId>looks</artifactId>
<version>2.2.2</version>
</dependency>

The generated .project file for this bundle only has one linked resource 
to one of the artifacts:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
   <name>org.protege.common</name>
   <comment>Core Protege Libraries. NO_M2ECLIPSE_SUPPORT: Project files 
created with the maven-eclipse-plugin are not supported in 
M2Eclipse.</comment>
   <projects/>
   <buildSpec>
     <buildCommand>
       <name>org.eclipse.jdt.core.javabuilder</name>
     </buildCommand>
     <buildCommand>
       <name>org.eclipse.pde.ManifestBuilder</name>
     </buildCommand>
     <buildCommand>
       <name>org.eclipse.pde.SchemaBuilder</name>
     </buildCommand>
   </buildSpec>
   <natures>
     <nature>org.eclipse.jdt.core.javanature</nature>
     <nature>org.eclipse.pde.PluginNature</nature>
   </natures>
   <linkedResources>
     <link>
       <name>looks-2.2.2.jar</name>
       <type>1</type>
<location>C:/Users/vendetti/.m2/repository/com/jgoodies/looks/2.2.2/looks-2.2.2.jar</location>
     </link>
   </linkedResources>
</projectDescription>

When I try to import the existing PDE project into Eclipse, I get 
compiler errors since the other two artifacts aren't listed as linked 
resources.

Is there something I'm missing about how to properly use this plug-in?  
I'm using Maven version 3.1.0.  Any help and/or advice would be very 
much appreciated.

Jennifer




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


Re: mvn-eclipse-plugin problem with pde projects and linked resources

Posted by Barrie Treloar <ba...@gmail.com>.
> Oddly, the bundles run fine outside of the Eclipse environment.  My first
> few attempts at using the OSGi Framework launcher has left me with a slew
> of ClassNotFoundException errors at runtime.  Will need to investigate this
> further.
>
> Thanks for your help in getting me this far along.
>

Please post your problems and resolutions here.

Getting Eclipse PDE to work with Maven is still not an easy task and the
more material for google searches the better.

Re: mvn-eclipse-plugin problem with pde projects and linked resources

Posted by Jennifer Vendetti <ve...@stanford.edu>.
Hi Alejandro,

On 10/23/2013 2:15 PM, Alejandro.Endo@miranda.com wrote:
> it all depends if you are going the maven bundle plugin route (which is
> POM-centric and the manifest is auto generated) or manifest first, where
> the manifest is generated by hand (eclipse tooling helps with this though)
> and the pom is also generated by hand but it has a much smaller role (to
> be exact, there is a way to generate the pom, but you generate it once and
> manage it by hand after, whereas in the first way you never manage the
> manifest and it gets regenerated every time you build, in fact, you don't
> even commit the manifest in your VCS). The major difference is where are
> the dependencies managed. So this is the first decision you will need to
> make, if you haven't already made it

I'm using the maven-bundle-plugin for all of the OSGi bundles, so the 
manifest files are regenerated every time I build.  I don't have any 
manifest files committed in our source code repository.  I suppose this 
means I'm using the "POM first" approach.

> For the launcher to recognize the project as a bundle I think you just
> need the META-INF folder in the root of the project with an osgi-friendly
> MANIFEST.MF inside

Thank you for this pointer.  I manually created META-INF folders at the 
root of each project and placed copies of the generated MANIFEST.MF 
files in the folders.  Eclipse now recognizes projects as bundles.

> I'm not sure what you mean by Runnables, you mean a new launcher? the fact
> that you capitalise it makes me think of the java interface, but i don't
> see the connection

Sorry, yes - I meant that I wanted to create an OSGi Framework 
launcher.  I was able to start the process now that Eclipse recognized 
my projects as bundles:



Oddly, the bundles run fine outside of the Eclipse environment.  My 
first few attempts at using the OSGi Framework launcher has left me with 
a slew of ClassNotFoundException errors at runtime.  Will need to 
investigate this further.

Thanks for your help in getting me this far along.

Best,
Jennifer


Re: mvn-eclipse-plugin problem with pde projects and linked resources

Posted by Al...@miranda.com.
it all depends if you are going the maven bundle plugin route (which is 
POM-centric and the manifest is auto generated) or manifest first, where 
the manifest is generated by hand (eclipse tooling helps with this though) 
and the pom is also generated by hand but it has a much smaller role (to 
be exact, there is a way to generate the pom, but you generate it once and 
manage it by hand after, whereas in the first way you never manage the 
manifest and it gets regenerated every time you build, in fact, you don't 
even commit the manifest in your VCS). The major difference is where are 
the dependencies managed. So this is the first decision you will need to 
make, if you haven't already made it
https://docs.sonatype.org/display/TYCHO/OSGiDevelopmentWithMaven
http://stackoverflow.com/questions/11373009/should-i-use-pom-first-or-manifest-first-when-developing-osgi-application-with-m

For the launcher to recognize the project as a bundle I think you just 
need the META-INF folder in the root of the project with an osgi-friendly 
MANIFEST.MF inside

I'm not sure what you mean by Runnables, you mean a new launcher? the fact 
that you capitalise it makes me think of the java interface, but i don't 
see the connection

good luck,
Alejandro Endo | Software Designer/Concepteur de logiciels
Miranda Technologies is a brand of Belden Inc. 



From:   Jennifer Vendetti <ve...@stanford.edu>
To:     Maven Users List <us...@maven.apache.org>, 
Date:   2013-10-23 04:20 PM
Subject:        Re: mvn-eclipse-plugin problem with pde projects and 
linked resources



Hello Alejandro,

Thank you very much for the reply, but there is something I don't 
understand.

I'm using Eclipse Kepler, which has m2e.  I tried what you suggested. 
Importing as existing Maven projects works very well, with all 
dependencies detected and no compilation errors.  However, since Eclipse 
sees these as Maven projects rather than PDE projects, I'm unable to 
create a new Runnable of type OSGi Framework in the Run Configurations 
dialog.  Eclipse doesn't detect my projects as bundles.

How are you able to create Runnables with the OSGi Framework launcher? 
Any guidance is very much appreciated.

Best,
Jennifer


On 10/23/2013 12:56 PM, Alejandro.Endo@miranda.com wrote:
> I use pde + maven-bundle-plugin + osgi framework launcher but i don't 
use
> mvn-eclipse-plugin. You should be using m2e, which works completely
> different than m-eclipse-p. Just do a final eclipse:clean and forget 
about
> that plugin.
>
> Then make sure that your eclipse has m2e (comes by default with any 
recent
> eclipse) and do a File > import > maven > Existing Maven project if your
> project is already in the filesystem. If not choose "checkout maven
> project from SCM" instead
>
> good luck
> Alejandro Endo | Software Designer/Concepteur de logiciels
>
>
>
>
> From:   Jennifer Vendetti <ve...@stanford.edu>
> To:     users@maven.apache.org,
> Date:   2013-10-23 03:49 PM
> Subject:        mvn-eclipse-plugin problem with pde projects and linked
> resources
>
>
>
> Hello,
>
> I just took over the maintenance of several OSGi bundles.  I added the
> mvn-eclipse-plugin to the POM files for each of the bundles because I'd
> like to generate the necessary Eclipse project files to work with the
> source code and use the OSGi Framework launcher in the Eclipse IDE:
>
> <plugin>
> <artifactId>maven-eclipse-plugin</artifactId>
> <version>2.9</version>
> <configuration>
> <pde>true</pde>
> </configuration>
> </plugin>
>
> For reasons I don't understand, running "mvn eclipse:eclipse" generates
> a .project file with an incomplete set of linked resources.  For
> example, I have a POM file for one of the bundles that has the following
> 3 dependencies:
>
> <dependency>
>    <groupId>log4j</groupId>
>    <artifactId>log4j</artifactId>
>    <version>1.2.17</version>
>    </dependency>
>
> <dependency>
> <groupId>org.apache.felix</groupId>
> <artifactId>org.apache.felix.main</artifactId>
> <version>4.2.1</version>
> </dependency>
>
> <dependency>
> <groupId>com.jgoodies</groupId>
> <artifactId>looks</artifactId>
> <version>2.2.2</version>
> </dependency>
>
> The generated .project file for this bundle only has one linked resource
> to one of the artifacts:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <projectDescription>
>     <name>org.protege.common</name>
>     <comment>Core Protege Libraries. NO_M2ECLIPSE_SUPPORT: Project files
> created with the maven-eclipse-plugin are not supported in
> M2Eclipse.</comment>
>     <projects/>
>     <buildSpec>
>       <buildCommand>
>         <name>org.eclipse.jdt.core.javabuilder</name>
>       </buildCommand>
>       <buildCommand>
>         <name>org.eclipse.pde.ManifestBuilder</name>
>       </buildCommand>
>       <buildCommand>
>         <name>org.eclipse.pde.SchemaBuilder</name>
>       </buildCommand>
>     </buildSpec>
>     <natures>
>       <nature>org.eclipse.jdt.core.javanature</nature>
>       <nature>org.eclipse.pde.PluginNature</nature>
>     </natures>
>     <linkedResources>
>       <link>
>         <name>looks-2.2.2.jar</name>
>         <type>1</type>
> 
<location>C:/Users/vendetti/.m2/repository/com/jgoodies/looks/2.2.2/looks-2.2.2.jar</location>
>       </link>
>     </linkedResources>
> </projectDescription>
>
> When I try to import the existing PDE project into Eclipse, I get
> compiler errors since the other two artifacts aren't listed as linked
> resources.
>
> Is there something I'm missing about how to properly use this plug-in?
> I'm using Maven version 3.1.0.  Any help and/or advice would be very
> much appreciated.
>
> Jennifer
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
> DISCLAIMER:
> Privileged and/or Confidential information may be contained in this
> message. If you are not the addressee of this message, you may not
> copy, use or deliver this message to anyone. In such event, you
> should destroy the message and kindly notify the sender by reply
> e-mail. It is understood that opinions or conclusions that do not
> relate to the official business of the company are neither given
> nor endorsed by the company.
> Thank You.
>


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



DISCLAIMER:
Privileged and/or Confidential information may be contained in this
message. If you are not the addressee of this message, you may not
copy, use or deliver this message to anyone. In such event, you
should destroy the message and kindly notify the sender by reply
e-mail. It is understood that opinions or conclusions that do not
relate to the official business of the company are neither given
nor endorsed by the company.
Thank You.

Re: mvn-eclipse-plugin problem with pde projects and linked resources

Posted by Jennifer Vendetti <ve...@stanford.edu>.
Hello Alejandro,

Thank you very much for the reply, but there is something I don't 
understand.

I'm using Eclipse Kepler, which has m2e.  I tried what you suggested.  
Importing as existing Maven projects works very well, with all 
dependencies detected and no compilation errors.  However, since Eclipse 
sees these as Maven projects rather than PDE projects, I'm unable to 
create a new Runnable of type OSGi Framework in the Run Configurations 
dialog.  Eclipse doesn't detect my projects as bundles.

How are you able to create Runnables with the OSGi Framework launcher?  
Any guidance is very much appreciated.

Best,
Jennifer


On 10/23/2013 12:56 PM, Alejandro.Endo@miranda.com wrote:
> I use pde + maven-bundle-plugin + osgi framework launcher but i don't use
> mvn-eclipse-plugin. You should be using m2e, which works completely
> different than m-eclipse-p. Just do a final eclipse:clean and forget about
> that plugin.
>
> Then make sure that your eclipse has m2e (comes by default with any recent
> eclipse) and do a File > import > maven > Existing Maven project if your
> project is already in the filesystem. If not choose "checkout maven
> project from SCM" instead
>
> good luck
> Alejandro Endo | Software Designer/Concepteur de logiciels
>
>
>
>
> From:   Jennifer Vendetti <ve...@stanford.edu>
> To:     users@maven.apache.org,
> Date:   2013-10-23 03:49 PM
> Subject:        mvn-eclipse-plugin problem with pde projects and linked
> resources
>
>
>
> Hello,
>
> I just took over the maintenance of several OSGi bundles.  I added the
> mvn-eclipse-plugin to the POM files for each of the bundles because I'd
> like to generate the necessary Eclipse project files to work with the
> source code and use the OSGi Framework launcher in the Eclipse IDE:
>
> <plugin>
> <artifactId>maven-eclipse-plugin</artifactId>
> <version>2.9</version>
> <configuration>
> <pde>true</pde>
> </configuration>
> </plugin>
>
> For reasons I don't understand, running "mvn eclipse:eclipse" generates
> a .project file with an incomplete set of linked resources.  For
> example, I have a POM file for one of the bundles that has the following
> 3 dependencies:
>
> <dependency>
>    <groupId>log4j</groupId>
>    <artifactId>log4j</artifactId>
>    <version>1.2.17</version>
>    </dependency>
>
> <dependency>
> <groupId>org.apache.felix</groupId>
> <artifactId>org.apache.felix.main</artifactId>
> <version>4.2.1</version>
> </dependency>
>
> <dependency>
> <groupId>com.jgoodies</groupId>
> <artifactId>looks</artifactId>
> <version>2.2.2</version>
> </dependency>
>
> The generated .project file for this bundle only has one linked resource
> to one of the artifacts:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <projectDescription>
>     <name>org.protege.common</name>
>     <comment>Core Protege Libraries. NO_M2ECLIPSE_SUPPORT: Project files
> created with the maven-eclipse-plugin are not supported in
> M2Eclipse.</comment>
>     <projects/>
>     <buildSpec>
>       <buildCommand>
>         <name>org.eclipse.jdt.core.javabuilder</name>
>       </buildCommand>
>       <buildCommand>
>         <name>org.eclipse.pde.ManifestBuilder</name>
>       </buildCommand>
>       <buildCommand>
>         <name>org.eclipse.pde.SchemaBuilder</name>
>       </buildCommand>
>     </buildSpec>
>     <natures>
>       <nature>org.eclipse.jdt.core.javanature</nature>
>       <nature>org.eclipse.pde.PluginNature</nature>
>     </natures>
>     <linkedResources>
>       <link>
>         <name>looks-2.2.2.jar</name>
>         <type>1</type>
> <location>C:/Users/vendetti/.m2/repository/com/jgoodies/looks/2.2.2/looks-2.2.2.jar</location>
>       </link>
>     </linkedResources>
> </projectDescription>
>
> When I try to import the existing PDE project into Eclipse, I get
> compiler errors since the other two artifacts aren't listed as linked
> resources.
>
> Is there something I'm missing about how to properly use this plug-in?
> I'm using Maven version 3.1.0.  Any help and/or advice would be very
> much appreciated.
>
> Jennifer
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
> DISCLAIMER:
> Privileged and/or Confidential information may be contained in this
> message. If you are not the addressee of this message, you may not
> copy, use or deliver this message to anyone. In such event, you
> should destroy the message and kindly notify the sender by reply
> e-mail. It is understood that opinions or conclusions that do not
> relate to the official business of the company are neither given
> nor endorsed by the company.
> Thank You.
>


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


Re: mvn-eclipse-plugin problem with pde projects and linked resources

Posted by Al...@miranda.com.
I use pde + maven-bundle-plugin + osgi framework launcher but i don't use 
mvn-eclipse-plugin. You should be using m2e, which works completely 
different than m-eclipse-p. Just do a final eclipse:clean and forget about 
that plugin. 

Then make sure that your eclipse has m2e (comes by default with any recent 
eclipse) and do a File > import > maven > Existing Maven project if your 
project is already in the filesystem. If not choose "checkout maven 
project from SCM" instead

good luck
Alejandro Endo | Software Designer/Concepteur de logiciels




From:   Jennifer Vendetti <ve...@stanford.edu>
To:     users@maven.apache.org, 
Date:   2013-10-23 03:49 PM
Subject:        mvn-eclipse-plugin problem with pde projects and linked 
resources



Hello,

I just took over the maintenance of several OSGi bundles.  I added the 
mvn-eclipse-plugin to the POM files for each of the bundles because I'd 
like to generate the necessary Eclipse project files to work with the 
source code and use the OSGi Framework launcher in the Eclipse IDE:

<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<pde>true</pde>
</configuration>
</plugin>

For reasons I don't understand, running "mvn eclipse:eclipse" generates 
a .project file with an incomplete set of linked resources.  For 
example, I have a POM file for one of the bundles that has the following 
3 dependencies:

<dependency>
  <groupId>log4j</groupId>
  <artifactId>log4j</artifactId>
  <version>1.2.17</version>
  </dependency>

<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.main</artifactId>
<version>4.2.1</version>
</dependency>

<dependency>
<groupId>com.jgoodies</groupId>
<artifactId>looks</artifactId>
<version>2.2.2</version>
</dependency>

The generated .project file for this bundle only has one linked resource 
to one of the artifacts:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
   <name>org.protege.common</name>
   <comment>Core Protege Libraries. NO_M2ECLIPSE_SUPPORT: Project files 
created with the maven-eclipse-plugin are not supported in 
M2Eclipse.</comment>
   <projects/>
   <buildSpec>
     <buildCommand>
       <name>org.eclipse.jdt.core.javabuilder</name>
     </buildCommand>
     <buildCommand>
       <name>org.eclipse.pde.ManifestBuilder</name>
     </buildCommand>
     <buildCommand>
       <name>org.eclipse.pde.SchemaBuilder</name>
     </buildCommand>
   </buildSpec>
   <natures>
     <nature>org.eclipse.jdt.core.javanature</nature>
     <nature>org.eclipse.pde.PluginNature</nature>
   </natures>
   <linkedResources>
     <link>
       <name>looks-2.2.2.jar</name>
       <type>1</type>
<location>C:/Users/vendetti/.m2/repository/com/jgoodies/looks/2.2.2/looks-2.2.2.jar</location>
     </link>
   </linkedResources>
</projectDescription>

When I try to import the existing PDE project into Eclipse, I get 
compiler errors since the other two artifacts aren't listed as linked 
resources.

Is there something I'm missing about how to properly use this plug-in? 
I'm using Maven version 3.1.0.  Any help and/or advice would be very 
much appreciated.

Jennifer




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



DISCLAIMER:
Privileged and/or Confidential information may be contained in this
message. If you are not the addressee of this message, you may not
copy, use or deliver this message to anyone. In such event, you
should destroy the message and kindly notify the sender by reply
e-mail. It is understood that opinions or conclusions that do not
relate to the official business of the company are neither given
nor endorsed by the company.
Thank You.