Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9007145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:36:31+00:00 2026-06-16T01:36:31+00:00

I’m trying to build a (war) project where I copied and modifed the pom.xml

  • 0

I’m trying to build a (war) project where I copied and modifed the pom.xml file from another piece of code, and for some reason when I mvn clean package the software it doesn’t include the classes into the associated *-classes.jar file. Maven version is 2.2.1 on Ubuntu 12.10.

I’m highly novice in maven, and largely manage by copy-and-paste from examples, so I basically have no idea how my pom works (it is included in full below).

The project has a <packaging>war</packaging> element, and the maven-war-plugin configuration section says to archiveClasses and attachClasses, which I presume is what causes the *-classes.jar file to be built. Once I’ve run the build, my target directory looks as follows:

richard@holly:~/Code/External/JavaServer2.0/target$ ls 
apidocs  generated-sources  surefire           sword2-server-1.0-classes.jar  sword2-server-1.0-sources.jar
classes  maven-archiver     sword2-server-1.0  sword2-server-1.0-javadoc.jar  sword2-server-1.0.war

But the sword2-server-1.0-classes.jar doesn’t contain any of the classes:

richard@holly:~/Code/External/JavaServer2.0/target$ jar tf sword2-server-1.0-classes.jar
META-INF/
META-INF/MANIFEST.MF
META-INF/maven/
META-INF/maven/org.swordapp/
META-INF/maven/org.swordapp/sword2-server/
META-INF/maven/org.swordapp/sword2-server/pom.xml
META-INF/maven/org.swordapp/sword2-server/pom.properties

Meanwhile all the other *.jar files in this directory contain all the relevant information for the source files (javadocs, source, etc, are all complete).

I’m no doubt missing some form of plugin configuration, but am so far unable to make any sense of the maven plugin documentation, so any help hugely appreciated.

The (nearly) full pom.xml (omitted the actual dependencies for brevity):

<?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/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>org.swordapp</groupId>
<artifactId>sword2-server</artifactId>
<version>1.0</version>
<packaging>war</packaging>

<name>SWORD v2 :: Common Server Library</name>
<description>
    Common Server Library with interfaces to be implemented by servers
    wishing to provide SWORD v2 support
</description>
<url>http://www.swordapp.org/</url>

<build>
    <plugins>
        <plugin>
            <artifactId>maven-release-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>6</source>
                <target>6</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
                <archive>
                    <manifest>
                        <addDefaultImplementationEntries>
                            true
                        </addDefaultImplementationEntries>
                        <addDefaultSpecificationEntries>
                            true
                        </addDefaultSpecificationEntries>
                    </manifest>
                </archive>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
                <execution>
                    <id>default</id>
                    <phase>package</phase>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
                <execution>
                    <id>default</id>
                    <phase>package</phase>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <configuration>
                <archiveClasses>true</archiveClasses>
                <attachClasses>true</attachClasses>
                <packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>
                <warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>
                <webResources>
                    <resource>
                        <filtering>true</filtering>
                        <directory>${basedir}/src/main/webapp</directory>
                        <includes>
                            <include>WEB-INF/web.xml</include>
                        </includes>
                    </resource>
                </webResources>
            </configuration>
            <executions>
                <execution>
                    <phase>prepare-package</phase>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

<dependencies>
    ....
</dependencies>
</project>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T01:36:32+00:00Added an answer on June 16, 2026 at 1:36 am

    It turns out that archiveClasses and attachClasses don’t play well together. The documentation for attachClasses says that it will put the files in the webapps classes directory into a *-classes.jar during the war build. But archiveClasses places the content of the classes directory in the webapp into a jar file in the webapp’s lib directory. Since this means that there are no classes in the classes directory to be put into the *-classes.jar if both these configuration flags are set to true.

    The answer is to remove archiveClasses from the configuration, and then everything behaves as expected.

    This seems like it’s probably a maven bug, and it behaves the same in both maven 2 and maven 3.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to render a haml file in a javascript response like so:
In my XML file chapters tag has more chapter tag.i need to display chapters
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm parsing an XML file, the creators of it stuck in a bunch social
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I am trying to understand how to use SyndicationItem to display feed which is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.