Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an example Maven file #2

Closed
ccleve opened this issue May 2, 2014 · 8 comments
Closed

Add an example Maven file #2

ccleve opened this issue May 2, 2014 · 8 comments

Comments

@ccleve
Copy link

ccleve commented May 2, 2014

For us non-Gradle users, it would be helpful to have an example of how to use this in Maven.

@pron
Copy link
Contributor

pron commented May 3, 2014

This might take some time, but I'm more than happy to accept contributions. I want this to become a community-run project.

@rodlogic
Copy link

This is a start, but doesn't work. I am placing all the jar deps in a lib/ folder. Does capsule expects all the jars to be unpacked in the main jar?

<assembly
    xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
    <id>capsule</id>
    <formats>
        <format>jar</format>
    </formats>
    <baseDirectory>/</baseDirectory>
    <dependencySets>
        <dependencySet>
            <outputDirectory>/</outputDirectory>
            <includes>
                <include>co.paralleluniverse:capsule:jar</include>
            </includes>
            <unpack>true</unpack>
            <unpackOptions>
                <includes>
                    <include>Capsule.class</include>
                </includes>
            </unpackOptions>
            <scope>runtime</scope>
        </dependencySet>
        <dependencySet>
            <outputDirectory>/lib</outputDirectory>
            <useProjectArtifact>true</useProjectArtifact>
            <unpack>false</unpack>
            <scope>runtime</scope>
        </dependencySet>
    </dependencySets>
</assembly>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.4</version><!--$NO-MVN-MAN-VER$-->
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>Capsule</mainClass>
                            <classpathPrefix>lib</classpathPrefix>
                            <addClasspath>true</addClasspath>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                        </manifest>
                        <manifestEntries>
                            <Application-Class>com.MYCOMPANY.MYPRODUCT.app.AppService</Application-Class>
                            <Extract-Capsule>false</Extract-Capsule>
                            <Min-Java-Version>1.7.0</Min-Java-Version>
                            <JVM-Args></JVM-Args>
                            <System-Properties></System-Properties>
                        </manifestEntries>
                    </archive>
                    <descriptors>
                        <descriptor>src/main/assembly/capsule.xml</descriptor>
                    </descriptors>
                </configuration>
            </plugin>

@pron
Copy link
Contributor

pron commented May 17, 2014

Thank you!
By default, Capsule adds only those jars at the root of the capsule to the classpath. Either put them there, or add lib to the App-Class-Path manifest attribute.

@rodlogic
Copy link

I tried removing the lib folder and this is what I get:

CAPSULE: Launching app app.AppService
CAPSULE: /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/bin/java  -Dcapsule.log=verbose -Dcapsule.jar=/work/trunk-all/app/target -classpath /work/trunk-all/app/target/app-5.4-SNAPSHOT-capsule.jar app.AppService
Error: Could not find or load main class 

@pron
Copy link
Contributor

pron commented May 19, 2014

Try upgrading to capsule 0.4.0. This seems like a bug that has been fixed.

@pron
Copy link
Contributor

pron commented May 22, 2014

Also, why is Extract-Capsule set to false? Aren't the dependencies embedded? If you're using embedded dependencies, don't set Extract-Capsule (or set it to true, which is the default).

@pron
Copy link
Contributor

pron commented May 23, 2014

Added a working demo (full capsule -- i.e. embedded dependencies -- only): https://github.com/puniverse/capsule-demo

@pron pron closed this as completed May 23, 2014
@pron pron reopened this May 24, 2014
@pron
Copy link
Contributor

pron commented May 24, 2014

That example now has an assembly for a capsule with external dependencies, too.

@pron pron closed this as completed May 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants