Why can not build resources?

Answered
 

IDEA can not build resources files.

In target/classes dir, I can not find resources files.So , the Application can not read my config.

But I try to copy resources to target/classes, the Application can read my config.

Please help me..

 

 

 

0
8 comments

Do you see resources when build by Maven from command line?

Does Build | Rebuild Project action help? Check if there are any excludes in Preferences(settings) | Build, Execution, Deployment | Compiler | Excludes.

Try re-create project configuration by re-importing the project completely from Maven pom.xml file via File | New | Project from Existing Sources and selecting main parent pom.xml file to import from. Try also with custom plugins disabled.

If issue remains provide idea.log and build.log files. For uploading you can use ftp://ftp.intellij.net/.uploads / https://uploads.services.jetbrains.com or any file sharing service.

0

Yes, I try to build by Maven from command line.The Application build success.

And I do not exclude files.

In this project, create new module by maven. Its resources can not build.

 

But I have some other modules. These modules can run and build. Only this module's resources can not build in idea.

I also try to delete this module.And create a same module. The result is the same

The problem came up this morning

 

Thanks!

 

idealog.zip
  Already uploaded

0

IDE cannot copy files because the access is denied to them:

2019-04-11 11:48:25,221 [ 5338] INFO - s.jps.incremental.FSOperations - Error copying /home/echo/Data/work/lesson-cloud/lesson-cloud-generate/src/main/resources/templates/Repository.ftl to /home/echo/Data/work/lesson-cloud/lesson-cloud-generate/target/classes/templates/Repository.ftl with NIO API
java.nio.file.AccessDeniedException: /home/echo/Data/work/lesson-cloud/lesson-cloud-generate/target/classes/templates/Repository.ftl
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixCopyFile.copy(UnixCopyFile.java:566)
at sun.nio.fs.UnixFileSystemProvider.copy(UnixFileSystemProvider.java:253)
at java.nio.file.Files.copy(Files.java:1274)
at org.jetbrains.jps.incremental.FSOperations.copy(FSOperations.java:414)
at org.jetbrains.jps.maven.compiler.MavenResourceFileProcessor.copyFile(MavenResourceFileProcessor.java:81)
at org.jetbrains.jps.maven.compiler.MavenResourcesBuilder.build(MavenResourcesBuilder.java:108)
at org.jetbrains.jps.maven.compiler.MavenResourcesBuilder.build(MavenResourcesBuilder.java:29)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildTarget(IncProjectBuilder.java:1038)
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:1019)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1075)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:969)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:798)
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:380)
at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:178)
at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:139)
at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:302)
at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:135)
at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:228)
at org.jetbrains.jps.service.impl.SharedThreadPoolImpl.lambda$executeOnPooledThread$0(SharedThreadPoolImpl.java:42)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

If you have antivirus/firewall or other program that can lock IDE process disable it or make sure that IDE settings directories IDE installation home and project files are excluded from the scan. Double check that IDE has r/w permissions to these files and folders. Re-locating the project into different directory could also help.

Also check with these plugins disabled: Loaded custom plugins: .ignore (2.6.2), AceJump (3.5.5), Alibaba Java Coding Guidelines (1.0.6), AsciiDoc (0.24.4), Background Image Plus + (1.0.2), CamelCase (2.1.0), CodeGlance (1.5.4), FindBugs-IDEA (1.0.1), Grep Console (8.6.162.000.5), IDE Features Trainer (191.6183.5), Iedis (3.13), LiveEdit (191.5109.14), Lombok (0.24-2018.3), Markdown Navigator (2.8.4), Material Theme UI (3.9.0.3), MyBatis Log Plugin (2.0.7), MyBatisCodeHelperPro (2.5-IDEA173-IDEA191), Properties to YAML Converter (1.0.2), Rainbow Brackets (5.16), Translation (2.3.2), codehelper.generator (2018.12.14)

0

Yes, I use different user modify this project.

But this module is not the bad module. This module is normal.

The bad module is lesson-cloud-auth.

And I tried it just now, chmod 777 -R lesson-cloud. But the result is the same.

Last month, it can work.

 

These custom plugins are  been used for a while.

Now, I have to use an another module when I want to read config.

It is very strange.

 

0

Do you have problem only with this specific project?

Try relocating the project to a different directory under your user home where current user has full access to files and folders and no other applications could possibly lock IDE build process.

If issue remains, delete all logs, restart IDE reproduce the issue and provide idea.log and build.log files.

0

So sorry, I cannot resolve this question.

 

I use a new computer to do this. The operating system is manjaro kde.

 

Clone my repo https://github.com/gzmuSoft/lesson-cloud  and modify lesson-cloud-auth dependencies, only download

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>

 

 

In master, create files src/main/java/cn/edu/gzmu/Application and application.yml,  then configure Spring facet.

@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
server:
port: 9999

Next, I delete all logs, restart IDE and run this application.

But the result is the same.The target not have application.yml file.

The log. Thanks!

File uploaded: log.zip
0

You have packaging = pom for pom.ml file. pom packaging is used only for aggregated maven modules. The resource files are not processed with this: you get the same behaviour when compiling project from command line maven. Remove 

<packaging>pom</packaging>

from pom.xml to have resource files processed.

0

On my god!

 

This is really a stupid mistake. I need to learn more knowledge.

 

Thanks!

0

Please sign in to leave a comment.