sakhtar1979 / onejar-maven-plugin

Automatically exported from code.google.com/p/onejar-maven-plugin
0 stars 0 forks source link

Enable to set manifest attribute One-Jar-Expand, One-Jar-Show-Expand, and One-Jar-Confirm-Expand #20

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
OneJar 0.96 supports manifest attribute One-Jar-Expand,
One-Jar-Show-Expand, and One-Jar-Confirm-Expand, which are not do-able by
using the plugin 1.4.1.

Original issue reported on code.google.com by JohnWu....@gmail.com on 26 Jan 2010 at 5:20

GoogleCodeExporter commented 9 years ago
Yes. That would be nice.

Thanks,
Hugo

Original comment by hugo.josefson.old@gmail.com on 26 Jan 2010 at 7:10

GoogleCodeExporter commented 9 years ago
Hello,

What about this issue ? When will it be fixed ? I really need this feature, 
because otherwise I can't deploy my application as one-jar file. And because 
"mainClass" attribute is already supported it shouldn't be so difficult ;)

Thank you
Lothar

Original comment by lothar.k...@gmail.com on 19 Jun 2010 at 1:59

GoogleCodeExporter commented 9 years ago
As a workaround, you may use maven-assembly-plugin with an assembly descriptor. 
In fact, that way, you can do whatever the one-jar allows you to do, not 
restrained by the plugin any more. See the code snippets below for your 
reference.

== in pom.xml ==
    <build>
        <plugins>
...
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <id>assemble-one-jar</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>com.simontuffs.onejar.Boot</mainClass>
                        </manifest>
                        <manifestEntries>
                            <One-Jar-Main-Class>org.myapp.Main</One-Jar-Main-Class>

                            <One-Jar-Expand>config/</One-Jar-Expand>
                            <One-Jar-Confirm-Expand>false</One-Jar-Confirm-Expand>
                            <One-Jar-Show-Expand>true</One-Jar-Show-Expand>
                        </manifestEntries>
                    </archive>
                    <descriptors>
                        <descriptor>src/main/assembly/one-jar.xml</descriptor>
                    </descriptors>
                </configuration>
            </plugin>
        </plugins>
    </build>
...
    <dependencies>
...
        <dependency>
            <groupId>com.simontuffs</groupId>
            <artifactId>one-jar-boot</artifactId>
            <version>0.96</version>
            <scope>runtime</scope>
        </dependency>
    </dependencies>

== one-jar.xml ==
<?xml version="1.0" encoding="UTF-8"?>

<assembly
    xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.1"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.1 http://maven.apache.org/xsd/assembly-1.1.1.xsd">

    <id>one-jar</id>
    <formats>
        <format>jar</format>
    </formats>

    <includeBaseDirectory>false</includeBaseDirectory>
    <dependencySets>
        <dependencySet>
            <outputDirectory></outputDirectory>
            <outputFileNameMapping></outputFileNameMapping>
            <unpack>true</unpack>
            <includes>
                <include>com.simontuffs:one-jar-boot</include>
            </includes>
        </dependencySet>
        <dependencySet>
            <outputDirectory>main</outputDirectory>
            <includes>
                <include>${project.groupId}:${project.artifactId}</include>
            </includes>
        </dependencySet>
        <dependencySet>
            <outputDirectory>lib</outputDirectory>
            <scope>runtime</scope>
            <excludes>
                <exclude>com.simontuffs:one-jar-boot</exclude>
                <exclude>${project.groupId}:${project.artifactId}</exclude>
            </excludes>
        </dependencySet>
    </dependencySets>

    <files>
        <file>
            <outputDirectory>config</outputDirectory>
            <source>config.properties</source>
        </file>
    </files>

</assembly>

Original comment by JohnWu....@gmail.com on 20 Jun 2010 at 2:51

GoogleCodeExporter commented 9 years ago
Thank you for your suggestion. I know the assembly plugin and use it already. 
But it would be a lot more convenient to have the same options for the plugin 
as for one-jar itself. And because all options are just entries in the 
manifest, it should be quit simple to provide these options ?
Taking a look at the source it seems to me that you just have to add some more 
of these commands to the 'getManifest' method:

manifest.getMainAttributes().putValue(...);

So it would be nice if we hopefully could get it in the next plugin version.

Lothar

Original comment by lothar.k...@gmail.com on 20 Jun 2010 at 6:03

GoogleCodeExporter commented 9 years ago
It would be cool if we had a more generic mechanism here that allows to add 
arbitrary headers. As experience and recent new developments in OneJar (e.g., 
http://sourceforge.net/apps/wordpress/one-jar/2010/06/27/guice-finalizer-regress
ion-rc9/) shows there sometimes are new headers introduced that always would 
need a new version of onejar-maven-plugin.

Original comment by bimsc...@gmail.com on 28 Feb 2011 at 9:54

GoogleCodeExporter commented 9 years ago
I am attaching a patch to allow one to specify arbitrary manifest properties in 
plugin config, e.g. 

<configuration>
  <manifestProperties>
     <property>
         <name>One-Jar-URL-Factory</name>
         <value>com.simontuffs.onejar.JarClassLoader$OneJarURLFactory</value>
      </property>
    </manifestProperties>
</configuration>

I would really appreciate if this or other similar solution could be 
incorporated into the next version of this great plugin. Thanks!

Original comment by s...@google.com on 11 Nov 2011 at 12:14

Attachments:

GoogleCodeExporter commented 9 years ago
I guess I did sort of the same thing here: 
http://code.google.com/p/onejar-maven-plugin/issues/detail?id=33
My patch uses a map though, which seems a bit more fitting. Also I've taken 
care to not break some of the already existing options.

Original comment by bwijsmul...@gmail.com on 10 Jan 2012 at 6:32

GoogleCodeExporter commented 9 years ago
1.4.5-SNAPSHOT offers the new feature, In my own case to get spring working 
properly:
<configuration>
 <manifestEntries>
  <One-Jar-URL-Factory>com.simontuffs.onejar.JarClassLoader$OneJarURLFactory</One-Jar-URL-Factory>
 </manifestEntries>
</configuration>

Please try the snapshot and confirm if this resolves your problems?

Original comment by bwijsmul...@gmail.com on 12 Jan 2012 at 10:51

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I've tested 1.4.5 with extra "Class-Path:" entries and it works great ... 
thanks so much!

Original comment by smoye...@gmail.com on 22 Oct 2012 at 9:42