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 8176235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:05:16+00:00 2026-06-06T23:05:16+00:00

I want to make my Maven build fail when I forget to declare serialVersionUIDs

  • 0

I want to make my Maven build fail when I forget to declare serialVersionUIDs in a Serializable class. With javac, that’s easy:

$ javac -Xlint:serial -Werror Source.java

Directly translating that to Maven doesn’t work:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.5.1</version>
            <configuration>
                <compilerArgument>-Xlint:serial -Werror</compilerArgument>
            </configuration>
        </plugin>

The compilerArgument is quoted, so javac receives only one argument, containing -Xlint:serial -Werror, instead of -Xlint:serial and -Werror as separate arguments. So you read the docs, and find compilerArguments:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.5.1</version>
            <configuration>
                <compilerArguments>
                    <Xlint:serial />
                    <Werror />
                </compilerArguments>
            </configuration>
        </plugin>

This looks weird – the colon makes serial element in the Xlint namespace, which isn’t declared anywhere – but it works… until you want to do a release:

$ mvn release:prepare

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare (default-cli) on project my-project: Error reading POM: Error on line 58: The prefix "Xlint" for element "Xlint:serial" is not bound.

Apparently, the regular POM reader handles XML namespaces in another way than the one used by the release plugin.

So how do I pass javac multiple command-line switches when some of those switches contain characters which aren’t valid for plain XML elements, without breaking the release plugin?

  • 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-06T23:05:17+00:00Added an answer on June 6, 2026 at 11:05 pm

    It seems that while spaces are escaped in compilerArgument, the same isn’t true for quotes. So, if you surround the spaces in the argument with quotes, you get two arguments:

    <compilerArgument>-Xlint:serial" "-Werror</compilerArgument>
    

    This invokes javac "-Xlint:serial" "-Werror" rather than javac "-Xlint:serial -Werror".

    There’s nothing in the docs about this that I can find.

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

Sidebar

Related Questions

I have a java library. I build it with Maven. I want to make
I have style sheet with a class name changebackgroundcolor i want make change in
I have read that to build multiple Maven projects in one step (with automatic
I'm trying to build a relative easy project and include Hibernate with maven. I'm
I want to make my first release of a multi-module maven project using the
I'm a student and i want make a build tool as a side project
As the title says, I want to have a build tool that quite much
I have created a Java Maven Build Hibernate 2.0 Application with Eclipse. I want
I want to make the build process for my Eclipse RCP plugin fully automatic.
Are there ant plugins that wrap maven so that I can make use of

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.