如何在spring boot中将maven设置为在特定文件夹中构建?

时间:2018-05-04 21:05:25

标签: java spring maven

我有一个基于弹簧启动的项目,该项目托管在google驱动器共享文件夹上,帮助我和我的团队实时协作。

我想更改默认目标目录,因此当我运行项目时,我的团队成员不必为构建进行同步,而只是同步我的编码。

我做了一些研究,但我尝试的不起作用是我的基础构建maven

declare
  l_t_basis_access_id   eckernel_mca.t_basis_access.t_basis_access_id%type;
  l_object_id           eckernel_mca.ov_area.object_id%type;
  l_name                eckernel_mca.ov_area.name%type;
begin
  -- SELECT "A"
  select t_basis_access_id 
    into l_t_basis_access_id
    from eckernel_mca.t_basis_access
    where role_id like 'MCA.GFS.LEAD';

  -- SELECT "A" returned a single value - proceed with the next SELECT "B"

  -- SELECT "B"
  select object_id, name 
  into l_object_id,l_name
  from eckernel_mca.ov_area
  where end_date is null
    and object_id in (select distinct replace(replace(replace(attribute_text,'(',''),')',''),'''','')
                      from eckernel_mca.t_basis_object_partition
                      where t_basis_access_id in (select t_basis_access_id
                                                  from eckernel_mca.t_basis_access
                                                  where role_id like 'MCA.GFS.LEAD'
                                                 )
                     );
exception
  when no_data_found then
    -- SELECT "A" didn't return anything and raised no_data_found; but, SELECT "B" might 
    -- raise it as well
    select object_id, name 
    into l_object_id,l_name
    from eckernel_mca.ov_area
    where end_date is null;

  when too_many_rows then
    -- Any SELECT involved in this code could return it, so - handle it, if necessary
end;

但这不起作用,而且maven说他能够找到主要的课程

默认maven配置是

以下的s
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
    <directory>c:/myProject</directory>
    <outputDirectory>c:/myProject/classes</outputDirectory>

</build>

我应该怎么做才能将此目标转到c:/ myProject

1 个答案:

答案 0 :(得分:1)

  • 使用此插件修复主类的问题:

    <plugin>
        <!-- Build an executable JAR file -->
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>3.0.2</version>
        <configuration>
            <archive>
                <manifest>
                   <mainClass>pacakgeAndClasseName</mainClass>
                </manifest>
            </archive>
        </configuration>
    </plugin>
    

而不是C:/myProject,请尝试C:\\myProjectC:\myProject

  • 如果第一个解决方案不起作用,您可以使用此插件:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.3.1</version>
        <configuration>
            <outputDirectory>yourPath</outputDirectory>
        </configuration>
    </plugin>