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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:15:01+00:00 2026-06-05T08:15:01+00:00

I have a maven POM that I’d like to use as a template, producing

  • 0

I have a maven POM that I’d like to use as a template, producing artifacts with different names depending on what arguments I pass to it. But I can’t figure out how to specify the artifactId at runtime.

If I parameterize the <artifactId> element like this:

<artifact>foo-${bar}</artifact>

maven complains:

[WARNING] ‘artifactId’ contains an expression but should be a constant.

If I leave out <artifactId> in the POM and try to specify it on the command line with

mvn -Dproject.artifactId=foo ...

maven complains:

[ERROR] ‘artifactId’ is missing.

Is there another trick I could use to accomplish this, other than resorting to generating the POM file on-the-fly from a template? [Hmm, maybe I could do that using maven resource filtering…]

  • 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-05T08:15:02+00:00Added an answer on June 5, 2026 at 8:15 am

    If I get it right you want to reuse a blueprint maven application and be able to change the artifactId.

    This use case can be best accomplished with Maven archetypes. See this to get you started. It’s fairly straight forward and its worth learning. You have your normal Maven project and you add variables like ${groupId} in your blueprint pom. They then get replaced by parameters given by you at the archetype generation:

    mvn archetype:generate                                  \
    -DarchetypeGroupId=<archetype-groupId>                \
    -DarchetypeArtifactId=<archetype-artifactId>          \
    -DarchetypeVersion=<archetype-version>                \
    -DgroupId=<my.groupid>                                \
    -DartifactId=<my-artifactId>
    

    There are also a lot of archetypes created by people on GitHub where you can learn more about structuring and filtering in Maven archetypes For example.

    Alternatively you can try to set up the Maven filtering without using the archetype system but I have no experience with that. I don’t think you can run a project without it having a valid artifactId, some generation must happen before that (like in generating from an archetype) but I’m not sure.

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

Sidebar

Related Questions

I'm looking for applications that have rich maven pom(s) and can show lot of
I have a maven application that I'd like to convert to Eclipse RCP. My
I have a Maven POM file with a plugin that runs on the test
I have a project (built from an AppFuse template) that requires Maven 2.2.1. So
I have a pom file that looks similar to this <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
I have a section in a POM that looks something like this: <scm> <connection>scm:cvs:ext:myhostname:/cvsroot/repo:module_name</connection>
I have a Maven pom that uses <packaging>war</packaging> . But actually, I don't want
Is it possible to have a different set of dependencies in a maven pom.xml
I would like to have Maven download the JARs listed in a pom.xml file.
I have a maven module that I need to use in the J2ME client

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.