Cannot resolve package 'struts-default' in struts.xml

Answered

Environment: IntelliJ 9.0.3

The file struts.xml has multiple errors (in red) because struts-default.xml is not resolved.

Example:
    <package name="abc" extends="struts-default">
with the error message:
    Cannot resolve package 'struts-default'

I added:
    Project Settings / Facets / Struts 2 / My Fileset
with the missing 'struts-default.xml' (from Maven struts2-core-2.1.8.1.jar!/struts-default.xml)

This does not resolve the problem.

What other settings are required to clear this error message?

Thanks
Mark

19 comments
Comment actions Permalink

I assume your own struts.xml is included in the same fileset? Where is it located? It must be inside any source-roots, also make sure to include corresponding source root in web facet source roots (checkbox).  Yann

0
Comment actions Permalink

Sure, struts.xml is included. It is in Default File Set for Struts 2 Facet.

0
Comment actions Permalink

Is this an existing project or a new project created with IDEA's project wizard?  It sounds like a more general problem with your project setup. Can you send me a stripped down ZIP of your project

? Thanks.
0
Comment actions Permalink

No post (wrong topic)

0
Comment actions Permalink

Please find attached iml-file for the project.

Which .idea files could be helpful?



Attachment(s):
ABC.iml.zip
0
Comment actions Permalink

your own struts.xml is not in the same fileset as struts-default.xml, please try to group them

0
Comment actions Permalink

THANKS. This resolved the issue.

0
Comment actions Permalink

I'm having the same issue, but by me, the files are grouped in the same fileset. Wonder what the issue can be?

0
Comment actions Permalink

Could you please share a screenshot of your facet setup? Is everything else resolving properly in your struts.xml?

0
Comment actions Permalink

No, it's causing numerous problems with my struts.xml file. Here is the screenshot:

 

0
Comment actions Permalink

Please try creating the Struts2 facet under the Web facet see https://confluence.jetbrains.com/pages/viewpage.action?pageId=35367

0
Comment actions Permalink

That seems to have resolved it. Thanks so much!

0
Comment actions Permalink

I'm afraid I celebrated a bit prematurely.... I saved the project, and all the errors resurfaced. Here is the current screenshot of my facets:

0
Comment actions Permalink

Is it possible for you to share your project to reproduce? You could upload it to https://uploads.services.jetbrains.com/ and share filename here.

0
Comment actions Permalink

Which files should I upload; the iml files?

0
Comment actions Permalink

ideally the whole project

0
Comment actions Permalink

Uploaded the project. This is the ID: 2021_03_12_CvWrZeBNVB8M1ncK

0
Comment actions Permalink

Ok, the errors I can reproduce locally (project did not setup 100% on my machine) are related to resolving <result> location. And this is specific to Web facet setup, specifically "Web Resource Directories" must be setup correctly to match local web resources path(s) and their corresponding deployment roots.

Please make sure there is only one (1) Web Facet and its setup is specifying paths correctly (see screenshot). Then resolving works for me.

Please see https://www.jetbrains.com/help/idea/web-facet-page.html.

0
Comment actions Permalink

Good now. It seems that it was indeed a duplicate web facet that caused it.

Thanks so much for your help!

0

Please sign in to leave a comment.