2016-08-05 32 views
0

enter image description here塞尔玛代码生成

按照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>

我创建塞尔玛样品,但不能产生的代码。运行时,出现错误

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

是否有任何其他配置应该被添加到生成的代码?

回答

0

我误解了编译时间的意思,的确,我应该运行maven命令进行干净安装。然后生成代码。