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

0
19 comments

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
Avatar
Permanently deleted user

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

0

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
Avatar
Permanently deleted user

No post (wrong topic)

0
Avatar
Permanently deleted user

Please find attached iml-file for the project.

Which .idea files could be helpful?



Attachment(s):
ABC.iml.zip
0

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

0
Avatar
Permanently deleted user

THANKS. This resolved the issue.

0
Avatar
Permanently deleted user

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

0

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

0
Avatar
Permanently deleted user

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

 

0

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

0
Avatar
Permanently deleted user

That seems to have resolved it. Thanks so much!

0
Avatar
Permanently deleted user

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

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
Avatar
Permanently deleted user

Which files should I upload; the iml files?

0

ideally the whole project

0
Avatar
Permanently deleted user

Uploaded the project. This is the ID: 2021_03_12_CvWrZeBNVB8M1ncK

0

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
Avatar
Permanently deleted user

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.