How do I fix a “declared package does not match the expected package” error on VSCode

Momozawa Sara :

I have a gradle project:

.
|-- src
|    |-- java
|    |    +-- myproj
|    |         +-- App.java
|    +-- test
|-- build.gradle
+-- ...

and App.java file looks like this:

package myproj;
//      ^^^^^^ error message

but VSCode tells me “The declared package "myproj" does not match the expected package "main.java.myproj"”. I know this is related to the file path, but I did not find out how to configure it.

I have installed the Java Extension Pack plug-in, what should I do next?

PS. I don’t want the configuration scheme to be too complicated, I’m just writing a very small program. It is best to be able to complete in setting.json.

cerbin :

Try to add "main" directory between src and java folder to match gradle folders structure.

Source: https://docs.gradle.org/current/userguide/organizing_gradle_projects.html

Este artigo é coletado da Internet.

Se houver alguma infração, entre em [email protected] Delete.

editar em
0

deixe-me dizer algumas palavras

0comentários
loginDepois de participar da revisão

Artigos relacionados

Declared package doesn't match the expected package inet.example.nclient error in omnet 4.0p1 in ubuntu 11.04

How do I fix conda UnsatisfiableError of my custom conda package?

How do I fix a vulnerable npm package in my package-lock.json that isn't listed in the package.json?

NumPy package gives an array() error how to fix this?

how to fix ChakraCore NuGet package error?

How do I debug CRM Connection Error in SSIS Package?

How do I resolve peer dependency error: The package [email protected] does not satisfy its siblings' peerDependencies requirements

How do I fix this error ?? "Exception Value: range() integer end argument expected, got float. "

how do I version my composer package

java package <package> does not exist -> Java Error

How can I fix the Expected a constant as index error?

Why i can't access my variable declared in package from sub declared in the same package in Perl?

What is a exception error and how do I fix it?

How do I fix the following error?

How do I fix unexpected token error?

How do I fix this MYSQL//Phpmyadmin error?

Failing to install yum package - Package does not match intended download

How do I fix the "image "pyimage10" doesn't exist" error, and why does it happen?

How can I resolve a package installation error in Julia on Windows?

vcpkg: How do I submit a request for a package update, or see if the package is due an update?

How do I add Unity support to a NuGet package?

How do I install an older version of a django package?

How do I format columns of a datatable using renderDataTable() in the DT package?

How do I 'prebuild' a vignette index for an R package?

How do I Import a user created package in Java?

How do I install a NuGet package into the second project in a solution?

How do I declare a variable with a type from another package in Go?

How do I use the appengine/urlfetch package with goauth2?

How do I combine these 3 SQL jobs into a single SSIS package?