Hello

You can play with the classpath in the Manifest file:

Example:

               <plugin>
                 <artifactId>maven-jar-plugin</artifactId>
                 <configuration>
                  <archive>
                    <manifest>
                      <addClasspath>true</addClasspath>
                      <mainClass>com.yourMainClass</mainClass>
                    </manifest>
                  </archive>
                 </configuration>
               </plugin>

http://maven.apache.org/plugins/maven-jar-plugin/jar-mojo.html
http://maven.apache.org/shared/maven-archiver/

Sonia

Hi, I've tried to add the code fragment you've specified into my pom, but
nothing changes at all. I've tried to understand from that plugin
descriptions what I've just said to be done, but did not notice any explicit
possibility how to change packaging. So I looked at it "if I include this
code in pom, then my libraries will be included", but that did not happen.

I've tried to change packaging to ear as noted, but that did not do anything
also. I still end up with .jar file which compile ok, but does not include
any libraries into final .jar.


here is our pom.xml, which probably will contain handfull of errors and lot
of nonsenses, but all I need at this time to be able to create usable (with
included libraries) build.


<?xml version="1.0" encoding="UTF-8"?>
<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>something</groupId>
    <artifactId>core</artifactId>
    <packaging>ejb</packaging>
    <name>EIRA Core</name>
    <version>1.0</version>
    <description>something</description>
    <url>something</url>
    <inceptionYear>2009</inceptionYear>
    <issueManagement>
        <system>Bugzilla</system>
        <url>something</url>
    </issueManagement>
    <ciManagement>
        <system>TeamCity</system>
        <url>something</url>
    </ciManagement>
    <scm>
        <connection>something</connection>
        <developerConnection>something</developerConnection>
        <url>something</url>
    </scm>
    <organization>
        <name>something</name>
        <url>something</url>
    </organization>

 
    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <targetJdk>${compileSource}</targetJdk>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
                <version>2.4.2</version>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>taglist-maven-plugin</artifactId>
                <version>2.3</version>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jdepend-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-changelog-plugin</artifactId>
                <configuration>
                    <conectionType>developerConnection</conectionType>
                    <username>SVNReader</username>
                    <password>something</password>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-changes-plugin</artifactId>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>changes-report</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jxr-plugin</artifactId>
            </plugin>
        </plugins>
    </reporting>
    <repositories>
        <repository>
            <id>jboss</id>
            <url>http://repository.jboss.com/maven2</url>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
        </dependency>
        <dependency>
            <groupId>net.sf.json-lib</groupId>
            <artifactId>json-lib</artifactId>
            <version>2.2.3</version>            
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-annotations</artifactId>
            <version>3.4.0.GA</version>
        </dependency>
        <dependency>
            <groupId>javax.ejb</groupId>
            <artifactId>ejb-api</artifactId>
            <version>3.0</version>
        </dependency>
        <dependency>
            <groupId>commons-httpclient</groupId>
            <artifactId>commons-httpclient</artifactId>
            <version>3.1</version>
        </dependency>
        <dependency>
            <groupId>javax.persistence</groupId>
            <artifactId>persistence-api</artifactId>
            <version>1.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.ejb</groupId>
            <artifactId>ejb-api</artifactId>
            <version>3.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jboss</groupId>
            <artifactId>jboss-annotations-ejb3</artifactId>
            <version>4.2.3.GA</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jboss</groupId>
            <artifactId>jboss-ejb3x</artifactId>
            <version>4.2.3.GA</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>hibernate</groupId>
            <artifactId>hibernate3</artifactId>
            <version>3.2.3.GA</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.14</version>
            <scope>provided</scope>
        </dependency>
        
        <dependency>
                                        <groupId>commons-fileupload</groupId>
                                        
<artifactId>commons-fileupload</artifactId>
                                        <version>1.2.1</version>
                                </dependency>
                                
                                <dependency>
                                        <groupId>commons-io</groupId>
                                        <artifactId>commons-io</artifactId>
                                        <version>1.4</version>
                                </dependency>
        
        <dependency>
                                        <groupId>eu.medsea.mimeutil</groupId>
                                        <artifactId>mime-util</artifactId>
                                        <version>1.3</version>
                                        <scope>system</scope>
                                
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/mime-util-1.3.jar</systemPath>
                                </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>${compileSource}</source>
                    <target>${compileSource}</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ejb-plugin</artifactId>
                <configuration>
                   <ejbVersion>3.0</ejbVersion>
                </configuration>
            </plugin>


             <plugin>
                 <artifactId>maven-jar-plugin</artifactId>
                 <configuration>
                  <archive>
                    <manifest>
                      <addClasspath>true</addClasspath>
                      <mainClass/>
                    </manifest>
                  </archive>
                 </configuration>
                </plugin>

        </plugins>
    </build>
    <distributionManagement>
        <site>
            <id>core</id>
            <name>EIRA Core</name>
            <url>file:///c:/Inetpub/wwwroot/EIRA/core</url>
        </site>
    </distributionManagement>
    <properties>
        <compileSource>1.5</compileSource>
        <netbeans.hint.deploy.server>JBoss4</netbeans.hint.deploy.server>
    </properties>

</project>

-- 
View this message in context: 
http://www.nabble.com/super-beginner-question---fail-to-properly-package-maven-project.-tp22667119p22679382.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to