|
View:
New views
9 Messages
—
Rating Filter:
Alert me
|
|
|
Using custom assembly descriptorHi everyone!
Maybe you can help me out with this. I want to build a executable jar file which must contain a war file within (because I have included a jetty server runner in it). Problem is if I use the predefined assembly descriptor to build it: <descriptorRef>jar-with-dependencies</descriptorRef> in my main pom the war file will not get copied into it. If I write my own descriptor e.g.: ------- <assembly> <id>jar-with-all-dependencies</id> <formats> <format>jar</format> </formats> <includeBaseDirectory>false</includeBaseDirectory> <dependencySets> <dependencySet> <unpack>true</unpack> <scope>runtime</scope> <unpackOptions> <excludes> <!--this doesnt work 100%....war file gets unpacked all the time in the jar too...i dont know why--> <exclude>*:war</exclude> </excludes> </unpackOptions> </dependencySet> <dependencySet> <unpack>false</unpack> <scope>runtime</scope> <includes> <include>*:war:*</include> </includes> </dependencySet> </dependencySets> <fileSets> <fileSet> <directory>${project.build.outputDirectory}</directory> </fileSet> </fileSets> </assembly> ------ the war file gets included but if I try to run the jar it cant find the main class so if I extract it the directory structure is messed up e.g. executable class is not in root folder but in target/classes Also if I use the standard jar-with-dependencies descriptor code seen here: http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html which is: ------ <assembly> <id>jar-with-dependencies</id> <formats> <format>jar</format> </formats> <includeBaseDirectory>false</includeBaseDirectory> <dependencySets> <dependencySet> <unpack>true</unpack> <scope>runtime</scope> </dependencySet> </dependencySets> <fileSets> <fileSet> <directory>${project.build.outputDirectory}</directory> </fileSet> </fileSets> </assembly> ----- it cant find the main class also it should be the same result as just using <descriptorRef>jar-with-dependencies</descriptorRef> in my main pom. I am using maven2. Thank you for your help |
|
|
Re: Using custom assembly descriptorThis will give you an executable war file, i.e.
java -jar foo.war which does what you want <?xml version="1.0" encoding="UTF-8"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <groupId>____</groupId> <artifactId>____</artifactId> <packaging>war</packaging> <dependencies> <!-- your dependencies... don't forget jetty --> </dependencies> <build> <plugins> <plugin> <artifactId>maven-war-plugin</artifactId> <configuration> <archive> <manifest> <mainClass>your.package.JettyMain</mainClass> </manifest> </archive> </configuration> </plugin> <plugin> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <phase>generate-resources</phase> <goals> <goal>unpack-dependencies</goal> </goals> <configuration> <includeTypes>jar</includeTypes> <outputDirectory>${project.build.directory}/${project.build.finalName}</outputDirectory> </configuration> </execution> </executions> </plugin> </plugins> </build> </project> 2009/7/1 olip <oliverpelz@...>: > > Hi everyone! > Maybe you can help me out with this. > > I want to build a executable jar file which must contain a war file within > (because I have included a jetty server runner in it). Problem is if I use > the predefined assembly descriptor to build it: > <descriptorRef>jar-with-dependencies</descriptorRef> in my main pom > > the war file will not get copied into it. > > If I write my own descriptor e.g.: > ------- > <assembly> > <id>jar-with-all-dependencies</id> > <formats> > <format>jar</format> > </formats> > <includeBaseDirectory>false</includeBaseDirectory> > <dependencySets> > <dependencySet> > <unpack>true</unpack> > <scope>runtime</scope> > > <unpackOptions> > <excludes> > <!--this doesnt work 100%....war file gets unpacked all the > time in the jar too...i dont know why--> > <exclude>*:war</exclude> > </excludes> > </unpackOptions> > > </dependencySet> > > <dependencySet> > <unpack>false</unpack> > <scope>runtime</scope> > <includes> > <include>*:war:*</include> > > </includes> > </dependencySet> > > > </dependencySets> > <fileSets> > <fileSet> > <directory>${project.build.outputDirectory}</directory> > </fileSet> > </fileSets> > </assembly> > > ------ > the war file gets included but if I try to run the jar it cant find the main > class so if I extract it the directory structure is messed up e.g. > executable class is not in root folder but in target/classes > > Also if I use the standard jar-with-dependencies descriptor code seen here: > http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html > > which is: > ------ > <assembly> > <id>jar-with-dependencies</id> > <formats> > <format>jar</format> > </formats> > <includeBaseDirectory>false</includeBaseDirectory> > <dependencySets> > <dependencySet> > <unpack>true</unpack> > <scope>runtime</scope> > </dependencySet> > </dependencySets> > <fileSets> > <fileSet> > <directory>${project.build.outputDirectory}</directory> > </fileSet> > </fileSets> > </assembly> > ----- > > it cant find the main class also it should be the same result as just using > <descriptorRef>jar-with-dependencies</descriptorRef> > > in my main pom. > > I am using maven2. > > Thank you for your help > -- > View this message in context: http://www.nabble.com/Using-custom-assembly-descriptor-tp24290434p24290434.html > Sent from the Maven - Users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@... > For additional commands, e-mail: users-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Using custom assembly descriptorhi I did lioke stephenconnolly suggested (see under for the details or the previous mail in the thread), but my java -jar foo.war gives me : Exception in thread "main" java.lang.NoClassDefFoundError: boot/JettyMain Caused by: java.lang.ClassNotFoundException: boot.JettyMain at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) Could not find the main class: boot.JettyMain. Program will exit. My manifest says Main-Class: boot.JettyMain and this main class is to be found under /WEB-INF/classes/boot/JettyMain.class. Any suggestion on how to resolve this ? thanks in advance zedros This will give you an executable war file, i.e. java -jar foo.war which does what you want <?xml version="1.0" encoding="UTF-8"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <groupId>____</groupId> <artifactId>____</artifactId> <packaging>war</packaging> <dependencies> <!-- your dependencies... don't forget jetty --> </dependencies> <build> <plugins> <plugin> <artifactId>maven-war-plugin</artifactId> <configuration> <archive> <manifest> <mainClass>your.package.JettyMain</mainClass> </manifest> </archive> </configuration> </plugin> <plugin> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <phase>generate-resources</phase> <goals> <goal>unpack-dependencies</goal> </goals> <configuration> <includeTypes>jar</includeTypes> <outputDirectory>${project.build.directory}/${project.build.finalName}</outputDirectory> </configuration> </execution> </executions> </plugin> </plugins> </build> </project> -- View this message in context: http://n2.nabble.com/Using-custom-assembly-descriptor-tp3189204p3699241.html Sent from the maven users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Using custom assembly descriptorIs the boot class in the jetty dependency?
If so, add the dependency to the dependency plugin section as well. Then, ensure the jar gets included into your war. --- Thank You… Mick Knutson, President BASE Logic, Inc. Enterprise Architecture, Design, Mentoring & Agile Consulting p. (866) BLiNC-411: (254-6241-1) f. (415) 685-4233 Website: http://baselogic.com Linked IN: http://linkedin.com/in/mickknutson Vacation Rental: http://tahoe.baselogic.com --- On Wed, Sep 23, 2009 at 8:28 AM, zedros <zedros.schwartz@...> wrote: > > hi > > I did lioke stephenconnolly suggested (see under for the details or the > previous mail in the thread), but my java -jar foo.war gives me : > Exception in thread "main" java.lang.NoClassDefFoundError: boot/JettyMain > Caused by: java.lang.ClassNotFoundException: boot.JettyMain > at java.net.URLClassLoader$1.run(URLClassLoader.java:200) > at java.security.AccessController.doPrivileged(Native Method) > at java.net.URLClassLoader.findClass(URLClassLoader.java:188) > at java.lang.ClassLoader.loadClass(ClassLoader.java:307) > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) > at java.lang.ClassLoader.loadClass(ClassLoader.java:252) > at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) > Could not find the main class: boot.JettyMain. Program will exit. > > My manifest says Main-Class: boot.JettyMain and this main class is to be > found under /WEB-INF/classes/boot/JettyMain.class. > > Any suggestion on how to resolve this ? > > thanks in advance > zedros > > This will give you an executable war file, i.e. > > java -jar foo.war > > which does what you want > > <?xml version="1.0" encoding="UTF-8"?> > <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 > http://maven.apache.org/xsd/maven-4.0.0.xsd" > xmlns="http://maven.apache.org/POM/4.0.0" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> > <modelVersion>4.0.0</modelVersion> > > <groupId>____</groupId> > <artifactId>____</artifactId> > <packaging>war</packaging> > > <dependencies> > <!-- your dependencies... don't forget jetty --> > </dependencies> > > <build> > <plugins> > <plugin> > <artifactId>maven-war-plugin</artifactId> > <configuration> > <archive> > <manifest> > <mainClass>your.package.JettyMain</mainClass> > </manifest> > </archive> > </configuration> > </plugin> > <plugin> > <artifactId>maven-dependency-plugin</artifactId> > <executions> > <execution> > <phase>generate-resources</phase> > <goals> > <goal>unpack-dependencies</goal> > </goals> > <configuration> > <includeTypes>jar</includeTypes> > > > <outputDirectory>${project.build.directory}/${project.build.finalName}</outputDirectory> > </configuration> > </execution> > </executions> > </plugin> > </plugins> > </build> > </project> > > > > -- > View this message in context: > http://n2.nabble.com/Using-custom-assembly-descriptor-tp3189204p3699241.html > Sent from the maven users mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@... > For additional commands, e-mail: users-help@... > > |
|
|
Re: Using custom assembly descriptorMick Knutson wrote: > > Is the boot class in the jetty dependency? > No, it's in the generated class of the war, under /WEB-INF/classes/boot/ But I'm going to try with a separate jar... -- View this message in context: http://n2.nabble.com/Using-custom-assembly-descriptor-tp3189204p3699383.html Sent from the maven users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Using custom assembly descriptorMick Knutson wrote: > > Is the boot class in the jetty dependency? > > If so, add the dependency to the dependency plugin section as well. > > Then, ensure the jar gets included into your war. > I did so, I chacked that the jar is present in my war but I still have the java.lang.ClassNotFoundException thanks still -- View this message in context: http://n2.nabble.com/Using-custom-assembly-descriptor-tp3189204p3699431.html Sent from the maven users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Using custom assembly descriptorI'll see if I can share a bit more specific code...
2009/9/23 zedros <zedros.schwartz@...>: > > hi > > I did lioke stephenconnolly suggested (see under for the details or the > previous mail in the thread), but my java -jar foo.war gives me : > Exception in thread "main" java.lang.NoClassDefFoundError: boot/JettyMain > Caused by: java.lang.ClassNotFoundException: boot.JettyMain > at java.net.URLClassLoader$1.run(URLClassLoader.java:200) > at java.security.AccessController.doPrivileged(Native Method) > at java.net.URLClassLoader.findClass(URLClassLoader.java:188) > at java.lang.ClassLoader.loadClass(ClassLoader.java:307) > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) > at java.lang.ClassLoader.loadClass(ClassLoader.java:252) > at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) > Could not find the main class: boot.JettyMain. Program will exit. > > My manifest says Main-Class: boot.JettyMain and this main class is to be > found under /WEB-INF/classes/boot/JettyMain.class. > > Any suggestion on how to resolve this ? > > thanks in advance > zedros > > This will give you an executable war file, i.e. > > java -jar foo.war > > which does what you want > > <?xml version="1.0" encoding="UTF-8"?> > <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 > http://maven.apache.org/xsd/maven-4.0.0.xsd" > xmlns="http://maven.apache.org/POM/4.0.0" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> > <modelVersion>4.0.0</modelVersion> > > <groupId>____</groupId> > <artifactId>____</artifactId> > <packaging>war</packaging> > > <dependencies> > <!-- your dependencies... don't forget jetty --> > </dependencies> > > <build> > <plugins> > <plugin> > <artifactId>maven-war-plugin</artifactId> > <configuration> > <archive> > <manifest> > <mainClass>your.package.JettyMain</mainClass> > </manifest> > </archive> > </configuration> > </plugin> > <plugin> > <artifactId>maven-dependency-plugin</artifactId> > <executions> > <execution> > <phase>generate-resources</phase> > <goals> > <goal>unpack-dependencies</goal> > </goals> > <configuration> > <includeTypes>jar</includeTypes> > > <outputDirectory>${project.build.directory}/${project.build.finalName}</outputDirectory> > </configuration> > </execution> > </executions> > </plugin> > </plugins> > </build> > </project> > > > > -- > View this message in context: http://n2.nabble.com/Using-custom-assembly-descriptor-tp3189204p3699241.html > Sent from the maven users mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@... > For additional commands, e-mail: users-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Using custom assembly descriptorFirst you want a jetty-helper module. This will depend on all the
jetty jars and have the jetty main class: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>____</groupId> <artifactId>jetty-helper</artifactId> <version>1-SNAPSHOT</version> <name>Helper module for making executable war files using jetty</name> <properties> <jetty-version>6.1.16</jetty-version> </properties> <dependencies> <dependency> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty</artifactId> <version>${jetty-version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-util</artifactId> <version>${jetty-version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-management</artifactId> <version>${jetty-version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-plus</artifactId> <version>${jetty-version}</version> <type>jar</type> <scope>provided</scope> </dependency> <dependency> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-naming</artifactId> <version>${jetty-version}</version> <type>jar</type> <scope>provided</scope> <exclusions> <!-- if you can figure out how to solve the issues with the class sealing in activation, you can remove the following exclusion --> <exclusion> <groupId>javax.activation</groupId> <artifactId>activation</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> </dependency> <!-- if you want to provide a JSVC support class, you need the following --> <dependency> <groupId>commons-daemon</groupId> <artifactId>commons-daemon</artifactId> <version>1.0.1</version> </dependency> </dependencies> <build> <plugins> <plugin> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> <manifest> <addClasspath>false</addClasspath> <mainClass>___.jetty.Main</mainClass> </manifest> </archive> </configuration> </plugin> <plugin> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <phase>generate-resources</phase> <goals> <goal>unpack-dependencies</goal> </goals> <configuration> <includeScope>provided</includeScope> <outputDirectory>${project.build.outputDirectory}</outputDirectory> </configuration> </execution> </executions> </plugin> </plugins> </build> </project> you then add your jetty.Main class, and optionally your JSVC commons daemon class to this module Then you have your web app as normal Then you have another module to give you the executable war file. You may be able to optimize this... I have not tried as I need a non-executable war file as well as an executable war file... here's the pom for the executable war file... it has no src directory <?xml version="1.0" encoding="UTF-8"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <groupId>____</groupId> <artifactId>war-executable</artifactId> <version>1-SNAPSHOT</version> <packaging>war</packaging> <name>Executable WAR</name> <dependencies> <dependency> <groupId>____</groupId> <artifactId>jetty-helper</artifactId> <version>1-SNAPSHOT</version> </dependency> <dependency> <groupId>____</groupId> <artifactId>___real war file___</artifactId> <version>1-SNAPSHOT</version> <type>war</type> </dependency> </dependencies> <build> <plugins> <plugin> <artifactId>maven-war-plugin</artifactId> <configuration> <archive> <manifest> <mainClass>___.jetty.Main</mainClass> </manifest> </archive> </configuration> </plugin> <plugin> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <phase>generate-resources</phase> <goals> <goal>unpack-dependencies</goal> </goals> <configuration> <includeTypes>jar</includeTypes> <outputDirectory>${project.build.directory}/${project.build.finalName}</outputDirectory> </configuration> </execution> </executions> </plugin> </plugins> </build> </project> 2009/9/23 Stephen Connolly <stephen.alan.connolly@...>: > I'll see if I can share a bit more specific code... > > > > 2009/9/23 zedros <zedros.schwartz@...>: >> >> hi >> >> I did lioke stephenconnolly suggested (see under for the details or the >> previous mail in the thread), but my java -jar foo.war gives me : >> Exception in thread "main" java.lang.NoClassDefFoundError: boot/JettyMain >> Caused by: java.lang.ClassNotFoundException: boot.JettyMain >> at java.net.URLClassLoader$1.run(URLClassLoader.java:200) >> at java.security.AccessController.doPrivileged(Native Method) >> at java.net.URLClassLoader.findClass(URLClassLoader.java:188) >> at java.lang.ClassLoader.loadClass(ClassLoader.java:307) >> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) >> at java.lang.ClassLoader.loadClass(ClassLoader.java:252) >> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) >> Could not find the main class: boot.JettyMain. Program will exit. >> >> My manifest says Main-Class: boot.JettyMain and this main class is to be >> found under /WEB-INF/classes/boot/JettyMain.class. >> >> Any suggestion on how to resolve this ? >> >> thanks in advance >> zedros >> >> This will give you an executable war file, i.e. >> >> java -jar foo.war >> >> which does what you want >> >> <?xml version="1.0" encoding="UTF-8"?> >> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 >> http://maven.apache.org/xsd/maven-4.0.0.xsd" >> xmlns="http://maven.apache.org/POM/4.0.0" >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> >> <modelVersion>4.0.0</modelVersion> >> >> <groupId>____</groupId> >> <artifactId>____</artifactId> >> <packaging>war</packaging> >> >> <dependencies> >> <!-- your dependencies... don't forget jetty --> >> </dependencies> >> >> <build> >> <plugins> >> <plugin> >> <artifactId>maven-war-plugin</artifactId> >> <configuration> >> <archive> >> <manifest> >> <mainClass>your.package.JettyMain</mainClass> >> </manifest> >> </archive> >> </configuration> >> </plugin> >> <plugin> >> <artifactId>maven-dependency-plugin</artifactId> >> <executions> >> <execution> >> <phase>generate-resources</phase> >> <goals> >> <goal>unpack-dependencies</goal> >> </goals> >> <configuration> >> <includeTypes>jar</includeTypes> >> >> <outputDirectory>${project.build.directory}/${project.build.finalName}</outputDirectory> >> </configuration> >> </execution> >> </executions> >> </plugin> >> </plugins> >> </build> >> </project> >> >> >> >> -- >> View this message in context: http://n2.nabble.com/Using-custom-assembly-descriptor-tp3189204p3699241.html >> Sent from the maven users mailing list archive at Nabble.com. >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscribe@... >> For additional commands, e-mail: users-help@... >> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Using custom assembly descriptorstephenconnolly wrote: > > I'll see if I can share a bit more specific code... > With pleasure ! I've in fact a "standard" web application, done through eclipse with m2eclipse. I've a launcher done this way (which I put in the src/main/java for packaging purposes) : package boot; import org.mortbay.jetty.Connector; import org.mortbay.jetty.Server; import org.mortbay.jetty.bio.SocketConnector; import org.mortbay.jetty.webapp.WebAppContext; public class JettyMain { public static void main(final String[] args) throws Exception { Server server = new Server(); SocketConnector connector = new SocketConnector(); // Set some timeout options to make debugging easier. connector.setMaxIdleTime(1000 * 60 * 60); connector.setSoLingerTime(-1); connector.setPort(8080); server.setConnectors(new Connector[] { connector }); WebAppContext bb = new WebAppContext(); bb.setServer(server); bb.setContextPath("/"); // TODO : update once picked up bb.setWar(""); // START JMX SERVER // MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); // MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer); // server.getContainer().addEventListener(mBeanContainer); // mBeanContainer.start(); server.addHandler(bb); try { System.out.println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP"); server.start(); System.in.read(); System.out.println(">>> STOPPING EMBEDDED JETTY SERVER"); while (System.in.available() == 0) { Thread.sleep(5000); } server.stop(); server.join(); } catch (Exception e) { e.printStackTrace(); } } } From eclipse, running this class as a Java application nicely starts my application. I would like to able to package this application in a standalone jar using jetty to run. Something which would be started through java -jar file.war (file.jar would be fine as well lol). And that's where I struggle. Having found this thread, I used the sample maven config given above this way : <?xml version="1.0" encoding="UTF-8"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <groupId>____</groupId> <artifactId>____</artifactId> <packaging>war</packaging> <dependencies> <!-- your dependencies... don't forget jetty --> </dependencies> <build> <plugins> <plugin> <artifactId>maven-war-plugin</artifactId> <configuration> <archive> <manifest> <mainClass>boot.JettyMain</mainClass> </manifest> </archive> </configuration> </plugin> <plugin> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <phase>generate-resources</phase> <goals> <goal>unpack-dependencies</goal> </goals> <configuration> <includeTypes>jar</includeTypes> <outputDirectory>${project.build.directory}/${project.build.finalName}</outputDirectory> </configuration> </execution> </executions> </plugin> </plugins> </build> </project> I then do mvn clean install, then cd target then java -jar mywar.war Since I've tried to put the boot package in a separate project but it doesn't help ++ -- View this message in context: http://n2.nabble.com/Using-custom-assembly-descriptor-tp3189204p3699602.html Sent from the maven users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
| Free embeddable forum powered by Nabble | Forum Help |