java - idea无法输出resource文件
黄舟
黄舟 2017-04-18 10:24:47
0
4
618

现在的项目是把sqlmap放在src/main/java文件夹下的(下图),但是target里面没有输出这个sqlmap目录

ps:无法将sqlmap 目录mark as resources

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(4)
Peter_Zhu

Your project structure is obviously maven. You can explicitly configure the resource file directory in the pom.xml file

<build>
    <finalName>你项目名</finalName>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
        </resource>
        <resource>
            <directory>src/main/java</directory>
            <includes>
                <include>**/*.xml</include>
                <include>**/*.properties</include>
            </includes>
        </resource>
    </resources>
</build>

Maven will only copy all files in the resource directory to the classpath, and only .java files will be compiled and output in the source directory. If you want to output other files in the source directory, you must configure resource
For details, see http ://www.programgo.com/arti...

阿神

Resources are placed under src/main/resources/.

阿神

The following part of main is parallel to java. Create a resources directory, which can be set to "resources"
Your java directory is already "Sources"

阿神

src/main/java已经配成了source builder path(我觉得等同于mark as resources
,编译打包后看classes文件夹可以验证我的说法),你要拿mapper就层级特别深com/.../sqlMap/XXX.xml
所以就参照楼上建议,新建src/main/resources/文件夹并将其设置成resources,将sqlMap的xmlPut the file in

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template