首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Selma代码生成器

Selma代码生成器
EN

Stack Overflow用户
提问于 2016-08-05 17:46:27
回答 2查看 2.1K关注 0票数 1

根据https://github.com/xebia-france/selma/blob/master/examples/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.mapper</groupId>
    <artifactId>Selma</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <build>
        <sourceDirectory>src</sourceDirectory>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.bsc.maven</groupId>
                    <artifactId>maven-processor-plugin</artifactId>
                    <version>2.2.4</version>
                    <configuration>
                        <defaultOutputDirectory>
                            ${project.build.directory}/generated-sources/selma
                        </defaultOutputDirectory>
                        <processors>
                            <processor>fr.xebia.extras.selma.codegen.MapperProcessor</processor>
                        </processors>
                    </configuration>
                    <executions>
                        <execution>
                            <id>process</id>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>process</goal>
                            </goals>
                        </execution>
                    </executions>
                    <dependencies>
                        <dependency>
                            <groupId>fr.xebia.extras</groupId>
                            <artifactId>selma-processor</artifactId>
                            <version>${project.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>fr.xebia.extras</groupId>
                            <artifactId>example-common</artifactId>
                            <version>0.16-SNAPSHOT</version>
                        </dependency>
                    </dependencies>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>1.9.1</version>
                    <executions>
                        <execution>
                            <id>add-source</id>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>add-source</goal>
                            </goals>
                            <configuration>
                                <sources>
                                    <source>${project.build.directory}/generated-sources/selma</source>
                                </sources>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <configuration>
                        <skip>true</skip>
                    </configuration>
                </plugin>

            </plugins>
        </pluginManagement>
    </build>

    <dependencies>
        <dependency>
            <groupId>fr.xebia.extras</groupId>
            <artifactId>selma-processor</artifactId>
            <version>0.15</version>
            <scope>provided</scope>
        </dependency>

        <!-- This is the only real dependency you will have in your binaries -->
        <dependency>
            <groupId>fr.xebia.extras</groupId>
            <artifactId>selma</artifactId>
            <version>0.15</version>
        </dependency>
    </dependencies>
</project>

我创建了一个selma示例,但无法生成代码。在运行时,会出现一个错误

Caused by: java.lang.ClassNotFoundException:com.mapper.mapper.SelmaMapperSelmaGeneratedClass

是否需要添加其他配置来生成代码?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2016-08-08 10:51:42

我误解了编译时间的含义,实际上,我应该运行maven命令清理安装。然后生成代码。

票数 1
EN

Stack Overflow用户

发布于 2016-08-29 21:21:32

要在没有Maven的eclipse中使用Selma,您应该将处理器和api jar添加到批注处理器插件的路径中。这应该在项目设置中的某个位置,请参阅插件文档: https://www.eclipse.org/jdt/apt/introToAPT.php

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38786211

复制
相关文章

相似问题

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