2011-09-06 9 views
6

Ho problemi con il Maven-fascio-plugin:Maven problema confezione bundle, noto come MNG-4338

voglio schierare il mio progetto come un fascio OSGi, perché io uso la confezione come bundle. Ma sembra che il pom non conosca una confezione come un fascio. Qui potete vedere il mio pom.xml:

<project ...>... 
    <packaging>bundle</packaging> 
<version>1.0.0</version> 

<name>Simple CXF project using spring configuration</name> 

<properties> 
    <cxf-version>2.4.2</cxf-version> 
</properties> 

<build> 
    <pluginManagement> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <configuration> 
        <source>1.5</source> 
        <target>1.5</target> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.felix</groupId> 
       <artifactId>maven-bundle-plugin</artifactId> 
       <extensions>true</extensions> 
       <version>2.3.5</version> 
       <configuration> 
        <instructions> 
         <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName> 
         <Bundle-Name>${project.name}</Bundle-Name> 
         <Bundle-Version>${project.version}</Bundle-Version> 
         <Export-Package>demo.hw.server</Export-Package> 
         <Bundle-Activator>demo.hw.server.Activator</Bundle-Activator> 
         <Require-Bundle>org.apache.cxf.bundle</Require-Bundle> 
        </instructions> 
       </configuration> 
      </plugin> 
     </plugins> 
    </pluginManagement> 
</build> 

<dependencies> 
    <dependency> 
     <groupId>org.apache.cxf</groupId> 
     <artifactId>cxf-rt-frontend-jaxws</artifactId> 
     <version>${cxf-version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.cxf</groupId> 
     <artifactId>cxf-rt-transports-http</artifactId> 
     <version>${cxf-version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.felix</groupId> 
     <artifactId>org.osgi.core</artifactId> 
     <version>1.4.0</version> 
    </dependency> 
</dependencies> 

</project> 

Si dice, questo bug è già stato fissato (http://jira.codehaus.org/browse/MNG-4338), ma a me sembra che hasn 't. Qualcuno ha riscontrato questo problema prima e ha trovato una soluzione?

Il messaggio di errore è simile a questo:

[INFO] Scanning for projects... 
[ERROR] The build could not read 1 project -> [Help 1] 
[ERROR] 
[ERROR] The project com.talend.liugang.cxf:java_first_jaxws:1.0.0 (C:\Users\Andreas\workspace\java_first_jaxws\pom.xml) has 1 error 
[ERROR]  Unknown packaging: bundle @ line 7, column 13 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException 

Con i migliori saluti, Saen

risposta

14

Dato il vostro esempio pom sopra, si deve solo spostare il Maven-fascio-plugin di fuori del nodo <pluginManagement>. <pluginManagement> viene normalmente utilizzato per scopi di ereditarietà nei genitori. Il pacchetto di bundle è fornito dal plugin maven-bundle (che è il motivo per cui è necessario il numero <extensions>true</extensions>), quindi in questo caso è necessario che questo plug-in sia esterno a <pluginManagement>.

<project ...>... 
    <packaging>bundle</packaging> 
    <version>1.0.0</version> 

    <name>Simple CXF project using spring configuration</name> 

    <properties> 
     <cxf-version>2.4.2</cxf-version> 
    </properties> 

    <build> 
     <pluginManagement> 
      <plugins> 
       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-compiler-plugin</artifactId> 
        <configuration> 
         <source>1.5</source> 
         <target>1.5</target> 
        </configuration> 
       </plugin> 
      </plugins> 
     </pluginManagement> 

     <plugins> 
      <plugin> 
       <groupId>org.apache.felix</groupId> 
       <artifactId>maven-bundle-plugin</artifactId> 
       <extensions>true</extensions> 
       <version>2.3.5</version> 
       <configuration> 
        <instructions> 
         <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName> 
         <Bundle-Name>${project.name}</Bundle-Name> 
         <Bundle-Version>${project.version}</Bundle-Version> 
         <Export-Package>demo.hw.server</Export-Package> 
         <Bundle-Activator>demo.hw.server.Activator</Bundle-Activator> 
         <Require-Bundle>org.apache.cxf.bundle</Require-Bundle> 
        </instructions> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 

    <dependencies> 
     <dependency> 
      <groupId>org.apache.cxf</groupId> 
      <artifactId>cxf-rt-frontend-jaxws</artifactId> 
      <version>${cxf-version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.cxf</groupId> 
      <artifactId>cxf-rt-transports-http</artifactId> 
      <version>${cxf-version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.felix</groupId> 
      <artifactId>org.osgi.core</artifactId> 
      <version>1.4.0</version> 
     </dependency> 
    </dependencies> 

</project> 
+9

Aveva un problema simile; Mi mancava il vero bit. Grazie! – Sbodd

+0

Ti benedica, Sbodd – user64141

0

Vedo un problema simile. Mi viene in mente che succede quando l'id del gruppo termina come inizia l'id artefatto. Cerco di riunire una cosa del genere:

<groupId>org.slf4j</groupId> 
<artifactId>slf4j-api.plugin</artifactId> 

Lo slf4j dal manufatto id viene cancellata al finisce come: org.slf4j.api.plugin nel Manifesto nome simbolico.

1

Yeap, il problema è che <GroupID> org.apache.felix </groupId > ha bisogno di essere al di fuori della <pluginManagement>.

Problemi correlati