Maven插件在安装时没有在Eclipse中运行

时间:2015-01-10 15:16:26

标签: java eclipse maven

我想在Maven的建筑项目中添加要导入数据库的2 * .sql文件。 当我在我的项目上启动“干净安装”时,插件没有被执行。我无法弄清楚出了什么问题。如果我运行“install”并且我的插件有“安装”目标,是不是应该执行插件?任何人都可以指出什么是错的,如何实现我想要的结果?这是我的配置,设置屏幕截图和“clean install”命令的输出:

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>voip-web</groupId>
  <artifactId>voip-web-server</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <org.springframework.version>3.2.1.RELEASE</org.springframework.version>        
  </properties>
  <dependencies>
    <!-- Spring -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <!-- Hibernate resources -->
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>4.2.11.Final</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>4.2.11.Final</version>
    </dependency>
    <!-- JSP Tag --> 
    <dependency>
        <groupId>taglibs</groupId>
        <artifactId>standard</artifactId>
        <version>1.1.2</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.1.2</version>
    </dependency>
    <!-- dependency to fix JSPServletException -->
    <dependency>
        <groupId>org.apache.tomcat</groupId>
        <artifactId>jsp-api</artifactId>
        <version>6.0.32</version>
        <scope>provided</scope>               
    </dependency>
    <!-- Apache Commons FileUpload -->
    <dependency>
        <groupId>commons-fileupload</groupId>
        <artifactId>commons-fileupload</artifactId>
        <version>1.3.1</version>
    </dependency>
    <!-- Apache Commons IO -->
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.4</version>
    </dependency>
    <!-- For messages and locale -->
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.3.2</version>
    </dependency>
    <!-- MySQL -->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.6</version>
    </dependency>
    <!-- Log4j -->
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.14</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <!-- Http Servlet -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
    </dependency>
    <!-- Jackson JSON Mapper -->
    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-mapper-asl</artifactId>
        <version>1.9.10</version>
    </dependency>
    <!-- JUnit -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.scala-lang</groupId>
        <artifactId>scala-library</artifactId>
        <version>2.10.4</version>
    </dependency>
    <!-- For integrating schema -->
    <dependency>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>sql-maven-plugin</artifactId>
        <version>1.5</version>
    </dependency>
  </dependencies>
  <build>
    <testSourceDirectory>src/test/java</testSourceDirectory>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </resource>
      <resource>
        <directory>src/main/webapp</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.3</version>
        <configuration>
          <failOnMissingWebXml>true</failOnMissingWebXml>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>sql-maven-plugin</artifactId>
        <version>1.5</version>
        <dependencies>
          <!-- specify the dependent JDBC driver here -->
          <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.6</version>
          </dependency>
        </dependencies>
        <!-- common configuration shared by all executions -->
        <configuration>
          <driver>com.mysql.jdbc.Driver</driver>
          <url>jdbc:mysql://localhost:3306/voip-web?autoReconnect=true</url>
          <username>root</username>
          <password>root</password>
        </configuration>

        <executions>

          <execution>
            <id>id.default-cli</id>
             <phase>default-cli</phase>
             <goals>
              <goal>install</goal>
             </goals>
            <!-- specific configuration for this execution -->
            <configuration>
              <!-- specify your SQL commands, can be all of the following configurations -->
              <echo
                            message="########### Creating Voip Web Database ##############"
              />
              <orderFile>ascending</orderFile>
              <autocommit>true</autocommit>
              <srcFiles>
                <srcFile>${basedir}/src/main/sql/2015-01-03-asterisk-db.sql</srcFile>
                <srcFile>${basedir}/src/main/sql/2015-01-04-voip-web.sql</srcFile>
              </srcFiles>
              <echo
                             message="##################### END ########################"
              />
            </configuration>
          </execution>

        </executions>
      </plugin>
    </plugins>
  </build>
</project>

Eclipse设置截图

enter image description here

Maven输出:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building voip-web-server 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ voip-web-server ---
[INFO] Deleting C:\EclipseKeplerJEE\myprojects\workspace\voip-web-server\target
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ voip-web-server ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO] Copying 44 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ voip-web-server ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 11 source files to C:\EclipseKeplerJEE\myprojects\workspace\voip-web-server\target\classes
[INFO] 
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ voip-web-server ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ voip-web-server ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\EclipseKeplerJEE\myprojects\workspace\voip-web-server\target\test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ voip-web-server ---
[INFO] Surefire report directory: C:\EclipseKeplerJEE\myprojects\workspace\voip-web-server\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.nikzgs.voip.web.entity.test.CallTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.094 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO] 
[INFO] --- maven-war-plugin:2.3:war (default-war) @ voip-web-server ---
[INFO] Packaging webapp
[INFO] Assembling webapp [voip-web-server] in [C:\EclipseKeplerJEE\myprojects\workspace\voip-web-server\target\voip-web-server-0.0.1-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\EclipseKeplerJEE\myprojects\workspace\voip-web-server\src\main\webapp]
[INFO] Webapp assembled in [968 msecs]
[INFO] Building war: C:\EclipseKeplerJEE\myprojects\workspace\voip-web-server\target\voip-web-server-0.0.1-SNAPSHOT.war
[INFO] 
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ voip-web-server ---
[INFO] Installing C:\EclipseKeplerJEE\myprojects\workspace\voip-web-server\target\voip-web-server-0.0.1-SNAPSHOT.war to C:\Users\Nikita\.m2\repository\voip-web\voip-web-server\0.0.1-SNAPSHOT\voip-web-server-0.0.1-SNAPSHOT.war
[INFO] Installing C:\EclipseKeplerJEE\myprojects\workspace\voip-web-server\pom.xml to C:\Users\Nikita\.m2\repository\voip-web\voip-web-server\0.0.1-SNAPSHOT\voip-web-server-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.432s
[INFO] Finished at: Sat Jan 10 17:08:06 EET 2015
[INFO] Final Memory: 15M/37M
[INFO] ------------------------------------------------------------------------

0 个答案:

没有答案