您能帮助我,如何一起生成QueryDSL和JPA元模型。
我试试
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.1.3</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/generated-sources/meta-model</outputDirectory>
<processor>org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor</processor>
<processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>${querydsl-apt.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
<version>${org.eclipse.persistence.jpa.modelgen.processor.version}</version>
</dependency>
</dependencies>
</plugin>
并且
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<version>${maven-processor-plugin.version}</version>
<executions>
<execution>
<id>process</id>
<goals>
<goal>process</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<processors>
<processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
<processor>org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor</processor>
</processors>
<outputDirectory>${project.build.directory}/generated-sources/meta-model</outputDirectory>
<compilerArguments>-Aeclipselink.persistencexml=${project.basedir}/src/main/resources/META-INF/persistence.xml</compilerArguments>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>${querydsl-apt.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
<version>${org.eclipse.persistence.jpa.modelgen.processor.version}</version>
</dependency>
</dependencies>
</plugin>
但该项目不会
我找到了一个解决方案,但是我在Jenkins上构建它时遇到了问题
<?xml version="1.0" encoding="UTF-8"?>
<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">
<parent>
<artifactId>by.softclub.services.mobile</artifactId>
<groupId>by.softclub.netteller.services</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>model-core</artifactId>
<version>1.1</version>
<name>Model-Core</name>
<packaging>ejb</packaging>
<dependencies>
<dependency>
<groupId>by.softclub.netteller.services</groupId>
<artifactId>by.softclub.banking.utils</artifactId>
<version>${by.softclub.banking.utils.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>by.softclub.netteller.services</groupId>
<artifactId>service-types</artifactId>
<version>${service-types.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>by.softclub.netteller.services</groupId>
<artifactId>printer</artifactId>
<version>${printer.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-7.0</artifactId>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.unitils</groupId>
<artifactId>unitils-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/java/</directory>
<filtering>true</filtering>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
</resource>
</resources>
<plugins>
<!--
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</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/annotations</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
-->
<!--
<plugin>
<groupId>com.ethlo.persistence.tools</groupId>
<artifactId>eclipselink-maven-plugin</artifactId>
<version>2.6.4.2</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>modelgen</goal>
</goals>
</execution>
</executions>
</plugin>
-->
<!--
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<version>${maven-processor-plugin.version}</version>
<executions>
<execution>
<id>process</id>
<goals>
<goal>process</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<processors>
<processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
<processor>org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor</processor>
</processors>
<outputDirectory>${project.build.directory}/generated-sources/meta-model</outputDirectory>
<compilerArguments>-Aeclipselink.persistencexml=${project.basedir}/src/main/resources/META-INF/persistence.xml</compilerArguments>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>${querydsl-apt.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
<version>${org.eclipse.persistence.jpa.modelgen.processor.version}</version>
</dependency>
</dependencies>
</plugin>
-->
<!--
<plugin>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-maven-plugin</artifactId>
<version>4.1.4</version>
<executions>
<execution>
<goals>
<goal>jpa-export</goal>
</goals>
<configuration>
<targetFolder>${project.build.directory}/generated-sources/meta-model</targetFolder>
<packages>
<package>by.softclub.model.entity</package>
</packages>
</configuration>
</execution>
</executions>
</plugin>
-->
<!--
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</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/meta-model</source>
<source>${project.build.directory}/generated-sources/annotations</source>
<source>${project.build.directory}/generated-sources/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
-->
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.1.3</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/generated-sources/meta-model</outputDirectory>
<processor>org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor</processor>
<processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
<processor>org.mapstruct.ap.MappingProcessor</processor>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>${querydsl-apt.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
<version>${org.eclipse.persistence.jpa.modelgen.processor.version}</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>1.1.0.Final</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<forkMode>never</forkMode>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>${maven-ejb-plugin.version}</version>
<configuration>
<filterDeploymentDescriptor>true</filterDeploymentDescriptor>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
<addMavenDescriptor>false</addMavenDescriptor>
<manifestEntries>
<implementation-version>${project.version}-r${buildNumber}</implementation-version>
<implementation-title>${project.build.finalName}</implementation-title>
<implementation-vendor>${user.name}</implementation-vendor>
<Dependencies>org.apache.cxf optional, org.apache.cxf.impl optional</Dependencies>
</manifestEntries>
</archive>
<ejbVersion>${ejbVersion}</ejbVersion>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>${buildnumber-maven-plugin.version}</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<doCheck>false</doCheck>
<doUpdate>true</doUpdate>
</configuration>
</plugin>
</plugins>
</build>
</project>
Maven install with maven-processor-plugin
如何设置项目构建。有一个支持元模型JPA和QueryDSL ???
... 的pom.xml
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
</dependency>
我也尝试添加
[ERROR] /E:/Server/V2_Change_Maven_Structure/by.services.mobile/model-core/src/main/java/by/model/dao/TransferLogDao.java:[103,50] cannot find symbol
[ERROR] symbol: class QTransferLog
[ERROR] location: class by.model.dao.TransferLogDao
但还有其他错误
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
</dependency>
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.1.3</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/generated-sources/meta-model</outputDirectory>
<processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>${querydsl-apt.version}</version>
</dependency>
</dependencies>
</plugin>
UPD 2
当我使用
时[INFO] --- apt-maven-plugin:1.1.3:process (default) @ model-core ---
E:\Server\V2_Change_Maven_Structure\by.services.mobile\model-core\src\main\java\by\softclub\model\dao\PushMessageStoreDao.java:5: error: cannot find symbol
import by.model.entity.PushMessageStore_;
^
symbol: class PushMessageStore_
location: package by.model.entity
E:\Server\V2_Change_Maven_Structure\by.services.mobile\model-core\src\main\java\by\softclub\model\dao\StreetTypeDao.java:5: error: cannot find symbol
import by.model.entity.StreetType_;
^
symbol: class StreetType_
location: package by.model.entity
E:\Server\V2_Change_Maven_Structure\by.services.mobile\model-core\src\main\java\by\softclub\model\dao\ImagesDAO.java:5: error: cannot find symbol
import by.model.entity.Images_;
^
symbol: class Images_
location: package by.model.entity
E:\Server\V2_Change_Maven_Structure\by.services.mobile\model-core\src\main\java\by\softclub\model\dao\UserDao.java:9: error: cannot find symbol
import by.model.entity.registration.Registration_;
^
symbol: class Registration_
location: package by.model.entity.registration
E:\Server\V2_Change_Maven_Structure\by.services.mobile\model-core\src\main\java\by\softclub\model\dao\UserActionDao.java:5: error: cannot find symbol
import by.model.entity.UserAction_;
所有人都很好。 该项目正在进行中。但我可以看到
{{1}}