Announcement Announcement Module
Collapse
No announcement yet.
maven-war-plugin will generate a manifest file and replace the bundlor-generated one? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • maven-war-plugin will generate a manifest file and replace the bundlor-generated one?

    When I use maven-war plugin, it always generate a manifest file for me. But I want to use the manifest file I created manually for DM server.

    Is there any way to tell maven-war plugin use the existing manifest file?

  • #2
    you can configure the war-plugin to use your own MANIFEST.MF with something like:

    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.0.2</version>
    <configuration>
    <archive>
    <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
    </archive>
    </configuration>
    </plugin>

    ..but (sorry if im stealing the thread - but i think you will experience the same problem anyway) when the war is built the MANIFEST.MF will be placed in WEB-INF/classes/META-INF/MANIFEST.MF. I haven't found any way of configuring the destination location within the war yet. I'm just starting to play around with the spring OSGi web extender - but i assume that the MANIFEST.MF is expected to be directly under /META-INF within the WAR.. Anyone?


    /janne

    Comment


    • #3
      I gave it another go and i think i got it working..

      As it turned out the war was built correctly (with MANIFEST.MF under <war>/META-INF/MANIFEST.MF. So when i deployed on DM server it started up ok.

      My problem was that when i tried to run the project on the server, from within eclipse it would fail. In this case the DM server would only see an empty manifest (right click deployed bundle in server view and select show manifest).

      I solved this by configuring the maven-bundle-plugin (i use it to generate the osgi manifest) to create the manifest under src/main/webapp/META-INF. After that i configured the WAR-plugin to use the manifest from that same location.

      And now i'm able to deploy the WAR directly to the DM-server or run it through eclipse.

      Comment


      • #4
        Full pom please?

        Can you please post the full pom.xml here?
        I am facing similar issues.

        Comment


        • #5
          Originally posted by jn73 View Post
          As it turned out the war was built correctly (with MANIFEST.MF under <war>/META-INF/MANIFEST.MF. So when i deployed on DM server it started up ok.

          My problem was that when i tried to run the project on the server, from within eclipse it would fail. In this case the DM server would only see an empty manifest (right click deployed bundle in server view and select show manifest).
          This is a really useful tidbit. I seem to be having the same issue. The war is being built correctly, but DM server in eclipse isn't seeing the manifest. Even when copying the manifest into my src dir, although eclipse sees it now, the webapp is still not deploying correctly, as indicated by the failure to honor my Web-ContextPath header.

          Comment


          • #6
            got build working without generating manifest in src dirs

            For what it's worth, I figured out a build configuration that correctly places the manifest file in the war and avoids generating any artifacts within the src directories.

            Some relevant details of my project setup are:

            HTML Code:
            .
            |-- pom.xml
            |-- src
            |   `-- main
            |       |-- java
            |       |   `-- com/ ... class files
            |       `-- webapp
            |           |-- WEB-INF
            |           |   |-- jsp/ ... jsp files
            |           |   |-- module-context.xml
            |           |   |-- osgi-context.xml
            |           |   |-- springapp-servlet.xml
            |           |   `-- web.xml
            |           `-- index.jsp
            `-- template.mf
            The maven build configuration has the bundlor generate the manifest.mf at compile time and package it correctly in the war:

            HTML Code:
                <build>
                    <plugins>
            
                        <plugin>
                            <groupId>com.springsource.bundlor</groupId>
                            <artifactId>com.springsource.bundlor.maven</artifactId>
                            <version>1.0.0.RELEASE</version>
                            <executions>
                                <execution>
                                    <id>bundlor</id>
                                    <goals>
                                        <goal>bundlor</goal>
                                    </goals>
                                    <phase>process-classes</phase>
                                </execution>
                            </executions>
                        </plugin>
            
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-war-plugin</artifactId>
                            <version>2.1-beta-1</version>
                            <configuration>
                                <archive>
                                    <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                                </archive>
                                <packagingExcludes>WEB-INF/classes/META-INF/MANIFEST.MF,WEB-INF/lib/**</packagingExcludes>
                            </configuration>
                        </plugin>
            
                    </plugins>
                </build>
            The resulting war contains:

            HTML Code:
            .
            |-- index.jsp
            |-- META-INF
            |   |-- MANIFEST.MF
            |   `-- maven/ ... auto-generated stuff
            `-- WEB-INF
                |-- module-context.xml
                |-- osgi-context.xml
                |-- springapp-servlet.xml
                |-- web.xml
                |-- classes
                |   `-- com/ ... class files
                `-- jsp/ ... jsp files
            Last edited by blahb; Apr 30th, 2010, 09:56 PM. Reason: bundlor version

            Comment

            Working...
            X