小编dav*_*ija的帖子

仅复制maven-war-plugin中的修改文件

我目前正在使用maven 3.x和maven-war-plugin.对于开发人员构建,我希望能够使用war:exploaded目标,但只能复制已更改的资源.有没有办法做到这一点?

我一直在查看文档并且无法在当前版本中找到这样做的方法,但过去曾经(在旧的maven 1.x版本中)属性maven.war.resources.overwrite会允许的.

谢谢.

plugins war overwrite maven

9
推荐指数
1
解决办法
2136
查看次数

使用自定义程序集描述符将类路径添加到清单

我有以下自定义程序集:

<assembly>
    <id>full</id>
    <formats>
        <format>jar</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <fileSets>
        <fileSet>
            <directory>${project.build.outputDirectory}</directory>
            <outputDirectory>/</outputDirectory>
        </fileSet>
    </fileSets>
</assembly>
Run Code Online (Sandbox Code Playgroud)

以下配置部分:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <configuration>
        <descriptors>
            <descriptor>src/main/assembly/assembly.xml</descriptor>
        </descriptors>
        <archive>
            <manifest>
                <mainClass>com.example.MyExample</mainClass>
                <addClasspath>true</addClasspath>
                <classpathPrefix>./lib/</classpathPrefix>
            </manifest>
        </archive>
    </configuration>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>single</goal>
            </goals>
        </execution>
    </executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)

根据有关maven程序集插件的文档,这应该将一个类路径项添加到清单文件中,但它不起作用.如果我使用已弃用的程序集目标而不是单个目标,它确实有效.

我注意到有人提到存档部分只有jar格式,但这就是我正在使用的.

当他们弃用程序集:汇编时,他们是否定义了一种正确执行此操作的新方法?我真的不喜欢使用已弃用的功能,但如果它们破坏了工作方式并且没有正确记录它,我真的不知道如何避免这种情况.

有没有人有任何正确的例子?

classpath maven-3 maven maven-assembly-plugin

9
推荐指数
1
解决办法
2万
查看次数

QueryDSL投影中的集合

我正在尝试使用投影从实体中获取数据与它具有的某种关系.然而.投影上的构造函数有三个参数; 集合,整数​​和另一个整数.如果我没有作为参数的集合,这一切都正常,但是一旦我添加集合,我就开始得到SQL语法查询错误.

这是我正在使用的一个例子......

@Entity
public class Resource {
    private Long id;
    private String name;
    private String path;
    @ManyToOne
    @JoinColumn(name = "FK_RENDITION_ID")
    private Rendition rendition;
}

@Entity
public class Document {
    private Long id;
    private Integer pageCount;
    private String code;
}

@Entity
public class Rendition {
    Long id;
    @ManyToOne
    @JoinColumn(name="FK_DOCUMENT_ID")
    Document doc;
    @OneToMany(mappedBy="rendition")
    Set<Resource> resources;
}

public class Projection {        
    @QueryProjection
    public Projection(Set<Resource> resources, Integer pageCount, String code) {
    }
}
Run Code Online (Sandbox Code Playgroud)

这是我正在使用的查询(不完全相同,这是我正在处理的简化版本)....

QRendition rendition = QRendition.rendition;
Projection projection = from(rendition)
    .where(rendition.document().id.eq(documentId) …
Run Code Online (Sandbox Code Playgroud)

collections querydsl

4
推荐指数
1
解决办法
5846
查看次数