首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Mapper文件(*.xml)未在构建项目上导出。用铁线莲

Mapper文件(*.xml)未在构建项目上导出。用铁线莲
EN

Stack Overflow用户
提问于 2022-10-04 16:42:25
回答 1查看 65关注 0票数 2

我正在开发一个maven项目,该项目使用数据库层的mybatis。在构建项目时,不会导出.xml文件。但是正在导出.java文件,它们位于同一个包中。所以项目运行给了我一个“找不到”的错误。

我复制了一个.xml文件并粘贴到target文件夹中(在正确的位置),这个项目运行得很完美。

我的pom.xml文件

代码语言:javascript
运行
复制
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">


<modelVersion> 4.0.0 </modelVersion>

  
  <groupId>com</groupId>
  <artifactId>project</artifactId>
  <version>1.0.10</version>
  
  <name>Description</name>
<properties>
    <maven.build.timestamp.format>yyyyMMdd-HHmm</maven.build.timestamp.format>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
    <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time</artifactId>
        <version>1.6</version>
    </dependency>
    <dependency>
        <groupId>net.sf.supercsv</groupId>
        <artifactId>super-csv</artifactId>
        <version>2.1.0</version>
    </dependency>
    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc6</artifactId>
        <version>11.2.0.3</version>
    </dependency>
    <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>1.9</version>
    </dependency>
    <dependency>
        <groupId>commons-dbcp</groupId>
        <artifactId>commons-dbcp</artifactId>
        <version>1.4</version>
    </dependency>
    <dependency>
        <groupId>org.mybatis</groupId>
        <artifactId>mybatis</artifactId>
        <version>3.4.2</version>
    </dependency>
    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>20.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-io</artifactId>
        <version>1.3.2</version>
    </dependency>
    <dependency>
      <groupId>org.freemarker</groupId>
      <artifactId>freemarker</artifactId>
      <version>2.3.26-incubating</version>
    </dependency>
</dependencies>

<build>
    <plugins>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.6.1</version>
            <configuration>
                <debug>true</debug>
                <source>1.8</source>
                <target>1.8</target>
                <!-- encoding: default é project.build.sourceEncoding -->
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.4</version>
            <!-- Para criação do JAR simples (sem dependências) -->
            <configuration>
                <archive>
                    <manifest>
                        <mainClass>com.workload.exporter.DataExporter</mainClass>
                    </manifest>
                </archive>
            </configuration>
        </plugin>
        
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.6</version>
            
        </plugin>
        
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.4</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
                <archive>
                    <manifest>
                        <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        <mainClass>com.workload.exporter.DataExporter</mainClass>
                    </manifest>
                </archive>
            </configuration>
        </plugin>

    </plugins>
</build>

在我的pom文件上还有其他配置要设置吗?

EN

回答 1

Stack Overflow用户

发布于 2022-10-04 17:50:34

我刚刚在pom文件中添加了参考资料部分,比如@swapyonubuntu注释。

代码语言:javascript
运行
复制
<resources>
  <resource>
     <directory>src/main/java</directory>
       <includes>
          <include>src/to/correct/folder/*.xml</include>
       </includes>
  </resource>
</resources>
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73951073

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档