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

  • Home
  • SEARCH
  • 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 7073705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:57:41+00:00 2026-05-28T05:57:41+00:00

I have an ant build.xml file with XJC task definition: <taskdef name=xjc classname=com.sun.tools.xjc.XJCTask> <classpath>

  • 0

I have an ant build.xml file with XJC task definition:

<taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
  <classpath>
    <fileset dir="jaxb" includes="*.jar" />
  </classpath>
</taskdef>

jaxb dir cotnains jaxb-xjc.jar with XJCTask class inside.

Then I call xjc task in some target:

<target name="mytarget">
 <xjc target="src" package="com.p1.Person" header="false">
   <schema dir="src/com/p1" includes="Person.xsd"/>
 </xjc>
</target>

Intellij IDEA doesn’t recognize the structure/schema of the xjc call and highlights all attributes (target, package, header) and containing elements (schema) in red.

If I choose Ant options and add jaxb-xjc.jar to additional class path list this doesn’t help.
I use bundled Ant 1.8.2

The bad thing is that when I compile it in IDEA I get a lot of related errors, but when I run build script everything works fine. I want to suppress these errors.

Any ideas?

  • 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-05-28T05:57:42+00:00Added an answer on May 28, 2026 at 5:57 am

    The answer comes from this comment in a related bug in the IDEA issue tracker.
    http://youtrack.jetbrains.net/issue/IDEA-11248#comment=27-57354

    For the XJCTask issues with IDEA, just use XJC2Task in your taskdef.

    If you look at the source of XJC2Task, it has the setters exposed so that IDEA can resolve them:
    http://grepcode.com/file/repo1.maven.org/maven2/com.sun.xml.bind/jaxb-xjc/2.1.13/com/sun/tools/xjc/XJC2Task.java#XJC2Task.setPackage%28java.lang.String%29

    However, XJCTask is just a class to dynamically delegate to JAXB1 or JAXB2 on the fly so IDEA is unable to resolve these properties since the class you are defining in the taskdef doesn’t have the setters on it.
    http://grepcode.com/file/repo1.maven.org/maven2/com.sun.xml.bind/jaxb-xjc/2.1.13/com/sun/tools/xjc/XJCTask.java#XJCTask.getCoreClassName%28%29

    Edit:
    Basically in JAXB2, XJCTask doesn’t actually contain the task – it delegates to the actual task XJC2Task.

    Here are some better links to the source:

    XJCTask in JAXB 1
    http://java.net/projects/jaxb/sources/version1/content/trunk/jaxb-ri/xjc/src/com/sun/tools/xjc/XJCTask.java?rev=197

    XJCTask in JAXB2
    http://java.net/projects/jaxb/sources/version2/content/trunk/jaxb-ri/xjc/facade/com/sun/tools/xjc/XJCTask.java?rev=3863

    XJC2Task in JAXB2
    http://java.net/projects/jaxb/sources/version2/content/trunk/jaxb-ri/xjc/src/com/sun/tools/xjc/XJC2Task.java?rev=3863

    If you look at your jaxb-xjc-ri-2.x-xx.jar you will see that it contains a package called “1/com/sun/tools/xjc/”

    This is what gets called from the XJCTask in JAXB2 if you run your ant task with setting the version to 1.0.
    I expect it was put in to allow easier transitions to v2 from v1 back in the day.

    XJC2Task is what is called if you are using v2.

    Realistically you aren’t going to set it to 1.0 so you might as just call the XJC2Task directly.

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

Sidebar

Related Questions

I have this build.xml file http://gist.github.com/315109 . Every task runs smoothly, but test .
We have a Java application and a supporting Ant build.xml file, and the team
I am learning about build.xml file for ant build. I have a simple Hello
I have a build.xml, from here I call a macro: <import file=macro_file.xml /> <ant-macro
I have an ANT build xml file which includes a path declaration with numerous
I have an android eclipse project and have generated the corresponding build.xml ant file
We have inherited an ant build file but now need to deploy to both
When you define an extension-point in an Ant build file you can have it
I've written an Ant build.xml file which obtains a number of source files via
Greeting, I'm trying to put some Beanshell script in my Ant build.xml file. I've

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.