
根据https://github.com/xebia-france/selma/blob/master/examples/pom.xml的说法
<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
是否需要添加其他配置来生成代码?
发布于 2016-08-08 10:51:42
我误解了编译时间的含义,实际上,我应该运行maven命令清理安装。然后生成代码。
发布于 2016-08-29 21:21:32
要在没有Maven的eclipse中使用Selma,您应该将处理器和api jar添加到批注处理器插件的路径中。这应该在项目设置中的某个位置,请参阅插件文档: https://www.eclipse.org/jdt/apt/introToAPT.php 。
https://stackoverflow.com/questions/38786211
复制相似问题