2016-01-18 36 views
0

以下POM文件生成构建内容到工作目录:MVN构建输出建立内容到工作目录

<?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:schemaLframetion="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.blahblah.orgname.appname</groupId> 
<artifactId>blahblah-appname-homepage</artifactId> 
<version>0.0.0-SNAPSHOT</version> 
<packaging>war</packaging> 
<description>home page application</description> 

<parent> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-parent</artifactId> 
    <version>1.2.5.RELEASE</version> 
    <relativePath /> 
    <!-- lookup parent from repository --> 
</parent> 

<properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 
    <java.version>1.7</java.version> 
    <start-class>com.blahblah.orgname.appname.homepage.Application</start-class> 
    <org.aspectj-version>1.7.2</org.aspectj-version> 
</properties> 

<dependencies> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-web</artifactId> 
     <exclusions> 
      <exclusion> 
       <groupId>org.springframework.boot</groupId> 
       <artifactId>spring-boot-starter-tomcat</artifactId> 
      </exclusion> 
      <exclusion> 
       <groupId>org.apache.tomcat.embed</groupId> 
       <artifactId>tomcat-embed-websocket</artifactId> 
      </exclusion> 
     </exclusions> 
    </dependency> 

    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-tomcat</artifactId> 
     <scope>provided</scope> 
    </dependency> 

    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-test</artifactId> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>com.jayway.jsonpath</groupId> 
     <artifactId>json-path-assert</artifactId> 
     <version>0.8.1</version> 
     <scope>test</scope> 
    </dependency> 

    <dependency> 
     <groupId>org.springframework.ldap</groupId> 
     <artifactId>spring-ldap-core</artifactId> 
     <version>1.3.2.RELEASE</version> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-social-linkedin</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>com.blahblah.frame.logging</groupId> 
     <artifactId>frame-logging-core</artifactId> 
     <version>0.0.1-SNAPSHOT</version> 
    </dependency> 

    <dependency> 
     <groupId>org.hamcrest</groupId> 
     <artifactId>hamcrest-all</artifactId> 
     <version>1.3</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>4.11</version> 
     <scope>test</scope> 
     <exclusions> 
      <exclusion> 
       <artifactId>hamcrest-core</artifactId> 
       <groupId>org.hamcrest</groupId> 
      </exclusion> 
     </exclusions> 
    </dependency> 
    <dependency> 
     <groupId>org.mockito</groupId> 
     <artifactId>mockito-core</artifactId> 
     <version>1.9.5</version> 
     <scope>test</scope> 
    </dependency> 

    <dependency> 
     <groupId>com.jayway.jsonpath</groupId> 
     <artifactId>json-path</artifactId> 
     <version>0.8.1</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>commons-httpclient</groupId> 
     <artifactId>commons-httpclient</artifactId> 
     <version>3.1</version> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-data-rest</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.neo4j</groupId> 
     <artifactId>neo4j-cypher-compiler-2.1</artifactId> 
     <version>2.1.5</version> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-data-solr</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.json</groupId> 
     <artifactId>json</artifactId> 
     <version>20140107</version> 
    </dependency> 
</dependencies> 

<build> 
    <outputDirectory>classes</outputDirectory> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <configuration> 
       <source>1.7</source> 
       <target>1.7</target> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-maven-plugin</artifactId> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-release-plugin</artifactId> 
      <version>2.5.2</version> 
      <configuration> 
       <tagNameFormat>[email protected]{project.version}</tagNameFormat> 
       <releaseProfiles>releases</releaseProfiles> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>exec-maven-plugin</artifactId> 
      <version>1.3.2</version> 
      <dependencies> 
       <dependency> 
        <groupId>org.aspectj</groupId> 
        <artifactId>aspectjrt</artifactId> 
        <version>${org.aspectj-version}</version> 
       </dependency> 
       <dependency> 
        <groupId>org.aspectj</groupId> 
        <artifactId>aspectjtools</artifactId> 
        <version>${org.aspectj-version}</version> 
       </dependency> 
      </dependencies> 
      <executions> 
       <execution> 
        <id>npm install (initialize)</id> 
        <goals> 
         <goal>exec</goal> 
        </goals> 
        <phase>initialize</phase> 
        <configuration> 
         <executable>npm</executable> 
         <arguments> 
          <argument>install</argument> 
         </arguments> 
        </configuration> 
       </execution> 
       <execution> 
        <id>npm dist (prepare-package)</id> 
        <goals> 
         <goal>exec</goal> 
        </goals> 
        <phase>prepare-package</phase> 
        <configuration> 
         <executable>npm</executable> 
         <arguments> 
          <argument>run-script</argument> 
          <argument>dist</argument> 
         </arguments> 
        </configuration> 
       </execution> 
      </executions> 
      <configuration> 
       <source>${jdk.version}</source> 
       <target>${jdk.version}</target> 
       <configuration> 
        <aspectLibraries> 
         <aspectLibrary> 
          <groupId>com.blahblah.frame.logging</groupId> 
          <artifactId>frame-logging-core</artifactId> 
         </aspectLibrary> 
        </aspectLibraries> 
       </configuration> 
       <showWeaveInfo>true</showWeaveInfo> 

      </configuration> 
     </plugin> 
    </plugins> 
    <pluginManagement> 
     <plugins> 
      <!--This plugin's configuration is used to store Eclipse m2e settings 
       only. It has no influence on the Maven build itself. --> 
      <plugin> 
       <groupId>org.eclipse.m2e</groupId> 
       <artifactId>lifecycle-mapping</artifactId> 
       <version>1.0.0</version> 
       <configuration> 
        <lifecycleMappingMetadata> 
         <pluginExecutions> 
          <pluginExecution> 
           <pluginExecutionFilter> 
            <groupId> 
             org.codehaus.mojo 
            </groupId> 
            <artifactId> 
             exec-maven-plugin 
            </artifactId> 
            <versionRange> 
             [1.3.2,) 
            </versionRange> 
            <goals> 
             <goal>exec</goal> 
            </goals> 
           </pluginExecutionFilter> 
           <action> 
            <ignore></ignore> 
           </action> 
          </pluginExecution> 
         </pluginExecutions> 
        </lifecycleMappingMetadata> 
       </configuration> 
      </plugin> 
     </plugins> 
    </pluginManagement> 
</build> 
<!-- SCM START: Plug in your git repository urls here before publishing 
    your app <scm> <url>[GIT_HTTPS_URL]</url> <connection>scm:git:[GIT_SSH_URL]</connection> 
    <developerConnection>scm:git:[GIT_SSH_URL]</developerConnection> <tag>HEAD</tag> 
    </scm> SCM END --> 

之前:

/src 

后:

/src 
/com 
/org 
/junit 

我窝它喜欢它输出到'生成'文件夹,以便它可以很容易地清理。我试着添加一个outputDirectory标签,但它不起作用。

+0

Maven默认会这样做。看起来你在这里摆弄别的东西。你是否可能在Eclipse中编译它而没有用m2e导入它? – chrylis

+0

? –

+0

@ A.DiMatteo这是我编辑发布时的错字。我现在修好了,谢谢。 – TOBlender

回答

1

你需要这样的构建部分,将其指定:

<build> 
    <directory>output</directory> 
</build> 
+0

我刚才尝试添加目录标签,但它不起作用。还有其他建议吗? – TOBlender

0

想通了。

在settings.xml文件原来你必须添加以下内容:

<localRepository>C:\PATH_YOU_WANT\.m2\repository</localRepository> 

默认情况下,localRepository被设置为构建的文件夹中。

相关问题