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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:43:30+00:00 2026-06-13T08:43:30+00:00

I’m working on a Maven plugin for JCasGen , which takes an XML type

  • 0

I’m working on a Maven plugin for JCasGen, which takes an XML type system description file and generates some Java classes. The type system description file often points to other type system description files in the same project via the classpath. JCasGen therefore needs a classpath containing all the XML type system description files in order to run. (These XML files must also be placed in the project’s final jar file because Java code may refer to them via the classpath too.)

The XML files are in src/main/resources so that Maven will copy them over to target/classes and they will be included in the project’s jar file. So the natural classpath to give to the plugin would be target/classes. However, if my plugin runs at the intuitive generate-sources phase, then the XML files in src/main/resources will not yet have been copied to target/classes, and JCasGen will fail.

So how do I structure things so that I can give the right classpath to JCasGen?

Here are a couple things I’ve thought of, but I don’t really know whether they make sense:

  1. Run the plugin on the process-resources phase, and just use target/classes for the classpath. This is what I’m currently doing and it seems to work. (I was worried about ensuring that my plugin always runs after the standard Maven copying of resources, but that seems to be what happens by default.) The main problem with this approach is that process-resources is not the intuitive phase for a plugin that generates sources.

  2. Build a classpath by concatenating the resource directories and target/classes:

    StringBuilder classpath = new StringBuilder();
    for (Resource resource : this.project.getBuild().getResources()) {
      classpath.append(resource.getDirectory());
      classpath.append(File.pathSeparatorChar);
    }
    classpath.append(this.project.getBuild().getOutputDirectory());
    

    I tried something like this and it seemed to work, but I worry that this could fail for complicated resources with includes or excludes.

  • 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-13T08:43:31+00:00Added an answer on June 13, 2026 at 8:43 am

    Just run the plugin on the process-resources phase. This solution is used by other plugins that generate sources and require access to the classpath:

    • GWT Maven Plugin gwt:resources and gwt:mergewebxml goals
    • jDTAUS Container Mojo spring-descriptor goal

    Note though that to get the classpath you should use project.getCompileClasspathElements(), not project.getBuild().getOutputDirectory(). The former will make sure you get, e.g. the target/classes directories of projects on which the current project depends.

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

Sidebar

Related Questions

I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have just tried to save a simple *.rtf file with some websites and
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 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
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small

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.