2013-04-25 155 views
1

我想在我的本地存儲庫(google-api-java-client 1.6.0-beta)中包含一個jar。爲了包含我們需要在pom.xml中編寫的內容,但是當我嘗試包含它時,它並未包含在本地Repository中。下面是我的項目的pom.xml:在Maven本地存儲庫中包含一個jar

<?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/maven-v4_0_0.xsd"> 

<modelVersion>4.0.0</modelVersion> 

<!-- The Basics --> 
<groupId>com.google.tryPredictionJava</groupId> 
<artifactId>gae-java</artifactId> 
<version>1.0-SNAPSHOT</version> 
<packaging>war</packaging> 

<name>try-prediction-java</name> 
<pluginRepositories> 
    <pluginRepository> 
     <id>maven-gae-plugin-repo</id> 
     <name>maven-gae-plugin repository</name> 
     <url>http://maven-gae-plugin.googlecode.com/svn/repository</url> 
    </pluginRepository> 
</pluginRepositories> 
<repositories> 
    <repository> 
     <id>google-api-services</id> 
     <url>http://mavenrepo.google-api-java-client.googlecode.com/hg</url> 
    </repository> 
    <repository> 
     <id>maven-gae-plugin-repo</id> 
     <name>maven-gae-plugin repository</name> 
     <url>http://maven-gae-plugin.googlecode.com/svn/repository</url> 
    </repository> 

</repositories> 

<dependencies> 
    <!-- 8th Apr <dependency> <groupId>com.google.api-client</groupId> <artifactId>google-api-client</artifactId> 
     <version>1.13.2-beta</version> </dependency> --> 

    <dependency> 
     <groupId>com.google.api-client</groupId> 
     <artifactId>google-api-client</artifactId> 
     <version>1.14.1-beta</version> 
    </dependency> 




    <dependency> 
     <groupId>com.google.api-client</groupId> 
     <artifactId>google-api-client</artifactId> 
     <version>1.6.0-beta</version> 
    </dependency> 

    <!-- <dependency> <groupId>com.google.api-client</groupId> <artifactId>google-api-client</artifactId> 
     <version>1.4.0-beta</version> </dependency> --> 


    <!-- 8th Apr <dependency> <groupId>com.google.oauth-client</groupId> <artifactId>google-oauth-client</artifactId> 
     <version>1.13.1-beta</version> </dependency> <dependency> <groupId>com.google.oauth-client</groupId> 
     <artifactId>google-oauth-client-servlet</artifactId> <version>1.13.1-beta</version> 
     </dependency> <dependency> <groupId>com.google.api.client</groupId> <artifactId>google-api-client-http</artifactId> 
     <version>1.2.3-alpha</version> </dependency> <dependency> <groupId>com.google.api-client</groupId> 
     <artifactId>google-api-client</artifactId> <version>1.13.2-beta</version> 
     </dependency> <dependency> <groupId>com.google.http-client</groupId> <artifactId>google-http-client-jackson2</artifactId> 
     <version>1.13.0-beta</version> </dependency> --> 

    <dependency> 
     <groupId>com.google.oauth-client</groupId> 
     <artifactId>google-oauth-client</artifactId> 
     <version>1.14.1-beta</version> 
    </dependency> 
    <dependency> 
     <groupId>com.google.oauth-client</groupId> 
     <artifactId>google-oauth-client-servlet</artifactId> 
     <version>1.14.1-beta</version> 
    </dependency> 
    <dependency> 
     <groupId>com.google.api.client</groupId> 
     <artifactId>google-api-client-http</artifactId> 
     <version>1.2.3-alpha</version> 
    </dependency> 
    <dependency> 
     <groupId>com.google.api-client</groupId> 
     <artifactId>google-api-client</artifactId> 
     <version>1.14.1-beta</version> 
    </dependency> 
    <dependency> 
     <groupId>com.google.http-client</groupId> 
     <artifactId>google-http-client-jackson2</artifactId> 
     <version>1.14.1-beta</version> 
    </dependency> 


    <!-- <dependency> <groupId>com.google.http-client</groupId> <artifactId>google-http-client-jackson2</artifactId> 
     <version>1.13.0-beta</version> </dependency> <dependency> <groupId>com.google.oauth-client</groupId> 
     <artifactId>google-oauth-client-jetty</artifactId> <version>1.13.0-beta</version> 
     </dependency> --> 



    <dependency> 
     <groupId>com.google.oauth-client</groupId> 
     <artifactId>google-oauth-client-jetty</artifactId> 
     <version>1.14.1-beta</version> 
    </dependency> 

    <!-- --> 

    <dependency> 
     <groupId>com.google.http-client</groupId> 
     <artifactId>google-http-client-jackson</artifactId> 
     <version>1.13.1-beta</version> 
    </dependency> 


    <!-- --> 
    <!-- Google App Engine meta-package --> 
    <dependency> 
     <groupId>net.kindleit</groupId> 
     <artifactId>gae-runtime</artifactId> 
     <version>${gae.version}</version> 
     <type>pom</type> 
    </dependency> 

    <dependency> 
     <groupId>org.datanucleus</groupId> 
     <artifactId>datanucleus-core</artifactId> 
     <version>${datanucleus.version}</version> 
     <scope>runtime</scope> 
    </dependency> 

    <dependency> 
     <groupId>javax.transaction</groupId> 
     <artifactId>jta</artifactId> 
     <version>1.1</version> 
    </dependency> 

    <!-- Java EE Servlet API. We need it to compile IndexServlet class. You can 
     probably remove it, if you don't explicitly use Servlets --> 
    <dependency> 
     <groupId>org.apache.geronimo.specs</groupId> 
     <artifactId>geronimo-servlet_2.5_spec</artifactId> 
     <version>1.2</version> 
     <scope>provided</scope> 
    </dependency> 

    <!-- Make use of JSP tags. Remove, if you don't use JSPs --> 
    <dependency> 
     <artifactId>standard</artifactId> 
     <groupId>taglibs</groupId> 
     <version>1.1.2</version> 
     <type>jar</type> 
     <scope>runtime</scope> 
    </dependency> 

    <!-- These dependencies are here just for enabling logging --> 
    <dependency> 
     <groupId>org.slf4j</groupId> 
     <artifactId>slf4j-api</artifactId> 
     <version>1.6.1</version> 
    </dependency> 

    <dependency> 
     <groupId>ch.qos.logback</groupId> 
     <artifactId>logback-classic</artifactId> 
     <version>0.9.24</version> 
    </dependency> 

    <!-- Test scope --> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>4.5</version> 
     <scope>test</scope> 
    </dependency> 

    <!-- GAE libraries for local testing as described here: http://code.google.com/appengine/docs/java/howto/unittesting.html --> 


    <dependency> 
     <groupId>com.google.appengine</groupId> 
     <artifactId>appengine-api-stubs</artifactId> 
     <version>${gae.version}</version> 
     <scope>test</scope> 
    </dependency> 

    <dependency> 
     <groupId>com.google.appengine</groupId> 
     <artifactId>appengine-testing</artifactId> 
     <version>${gae.version}</version> 
     <scope>test</scope> 
    </dependency> 

    <!-- <dependency> <groupId>com.google.api-client</groupId> <artifactId>google-api-client</artifactId> 
     <version>1.4.1-beta</version> </dependency> --> 

    <!-- 8th Apr <dependency> <groupId>com.google.api-client</groupId> <artifactId>google-api-client</artifactId> 
     <version>1.13.2-beta</version> </dependency> --> 
    <dependency> 
     <groupId>com.google.api-client</groupId> 
     <artifactId>google-api-client</artifactId> 
     <version>1.14.1-beta</version> 
    </dependency> 

    <dependency> 
     <groupId>com.google.apis</groupId> 
     <artifactId>google-api-services-prediction</artifactId> 
     <version>v1.4-1.3.0-beta</version> 
    </dependency> 

    <!--<dependency> <groupId>com.google.apis</groupId> <artifactId>google-api-services-plus</artifactId> 
     <version>v1-rev22-1.8.0-beta</version> </dependency> --> 
    <dependency> 
     <groupId>com.google.apis</groupId> 
     <artifactId>google-api-services-plus</artifactId> 
     <version>v1-rev62-1.14.1-beta</version> 
    </dependency> 
    <dependency> 
     <groupId>javax.jdo</groupId> 
     <artifactId>jdo2-api</artifactId> 
     <version>2.3-eb</version> 
     <exclusions> 
      <exclusion> 
       <groupId>javax.transaction</groupId> 
       <artifactId>transaction-api</artifactId> 
      </exclusion> 
     </exclusions> 
    </dependency> 
    <dependency> 
     <groupId>com.google.appengine</groupId> 
     <artifactId>appengine-api-1.0-sdk</artifactId> 
     <version>${gae.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>com.google.appengine</groupId> 
     <artifactId>appengine-api-labs</artifactId> 
     <version>${gae.version}</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>com.google.http-client</groupId> 
     <artifactId>google-http-client-jackson2</artifactId> 
     <version>1.14.1-beta</version> 
    </dependency> 
    <dependency> 
     <groupId>com.google.oauth-client</groupId> 
     <artifactId>google-oauth-client-jetty</artifactId> 
     <version>1.14.1-beta</version> 
    </dependency> 
    <!--<dependency> 8th Apr <groupId>com.google.http-client</groupId> <artifactId>google-http-client-jackson2</artifactId> 
     <version>1.13.0-beta</version> </dependency> <dependency> <groupId>com.google.oauth-client</groupId> 
     <artifactId>google-oauth-client-jetty</artifactId> <version>1.13.0-beta</version> 
     </dependency> --> 
</dependencies> 

<build> 
    <plugins> 

     <plugin> 
      <groupId>net.kindleit</groupId> 
      <artifactId>maven-gae-plugin</artifactId> 
      <version>0.8.4</version> 
      <configuration> 
       <port>8080</port> 
       <address>127.0.0.1</address> 
      </configuration> 
      <executions> 
       <execution> 
        <id>start-gae</id> 
        <goals> 
         <goal>stop</goal> 
         <goal>unpack</goal> 
         <goal>start</goal> 
        </goals> 
       </execution> 
       <execution> 
        <id>stop-gae</id> 
        <goals> 
         <goal>stop</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 

     <!-- This plug-in "enhances" your domain model objects (i.e. makes them 
      persistent for datanucleus) --> 
     <plugin> 
      <groupId>org.datanucleus</groupId> 
      <artifactId>maven-datanucleus-plugin</artifactId> 
      <version>1.1.4</version> 
      <configuration> 
       <!-- Make sure this path contains your persistent classes! --> 
       <mappingIncludes>**/model/*.class</mappingIncludes> 
       <verbose>true</verbose> 
       <enhancerName>ASM</enhancerName> 
       <api>JDO</api> 
      </configuration> 
      <executions> 
       <execution> 
        <phase>compile</phase> 
        <goals> 
         <goal>enhance</goal> 
        </goals> 
       </execution> 
      </executions> 
      <dependencies> 
       <dependency> 
        <groupId>org.datanucleus</groupId> 
        <artifactId>datanucleus-core</artifactId> 
        <version>${datanucleus.version}</version> 
        <exclusions> 
         <exclusion> 
          <groupId>javax.transaction</groupId> 
          <artifactId>transaction-api</artifactId> 
         </exclusion> 
        </exclusions> 
       </dependency> 
       <dependency> 
        <groupId>org.datanucleus</groupId> 
        <artifactId>datanucleus-rdbms</artifactId> 
        <version>${datanucleus.version}</version> 
       </dependency> 
       <dependency> 
        <groupId>org.datanucleus</groupId> 
        <artifactId>datanucleus-enhancer</artifactId> 
        <version>1.1.4</version> 
       </dependency> 
       <dependency> 
        <groupId>javax.jdo</groupId> 
        <artifactId>jdo2-api</artifactId> 
        <version>2.3-ec</version> 
        <scope>runtime</scope> 
       </dependency> 
      </dependencies> 
     </plugin> 

     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-war-plugin</artifactId> 
      <version>2.1-beta-1</version> 
      <configuration> 
       <webResources> 
        <resource> 
         <directory>src/main/webapp</directory> 
         <filtering>true</filtering> 
         <includes> 
          <include>**/appengine-web.xml</include> 
         </includes> 
        </resource> 
       </webResources> 
      </configuration> 
     </plugin> 

     <!-- The actual maven-gae-plugin. Type "mvn gae:run" to run project, "mvn 
      gae:deploy" to upload to GAE. --> 
     <plugin> 
      <groupId>net.kindleit</groupId> 
      <artifactId>maven-gae-plugin</artifactId> 
      <version>0.9.0</version> 
      <dependencies> 
       <dependency> 
        <groupId>net.kindleit</groupId> 
        <artifactId>gae-runtime</artifactId> 
        <version>${gae.version}</version> 
        <type>pom</type> 
       </dependency> 
      </dependencies> 
     </plugin> 

     <!-- Upload application to the appspot automatically, during release:perform --> 
     <plugin> 
      <artifactId>maven-release-plugin</artifactId> 
      <configuration> 
       <goals>gae:deploy</goals> 
      </configuration> 
     </plugin> 

     <!-- Java compiler version --> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>2.0</version> 
      <configuration> 
       <source>1.6</source> 
       <target>1.6</target> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 

<!-- Specify hard-coded project properties here --> 
<properties> 

    <!-- Sets the project's default encoding. http://docs.codehaus.org/display/MAVENUSER/POM+Element+for+Source+File+Encoding --> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 

    <!-- This is just for "eclipse:eclipse" goal to always attempt downloading 
     sources --> 
    <downloadSources>true</downloadSources> 

    <!-- Specify AppEngine version for your project. It should match SDK version 
     pointed to by ${gae.home} property (Typically, one used by your Eclipse plug-in) 
     <gae.version>1.6.1</gae.version> --> 
    <gae.version>1.6.3</gae.version> 

    <!-- Upload to http://test.latest.<applicationName>.appspot.com by default --> 
    <gae.application.version>test</gae.application.version> 

    <datanucleus.version>1.1.5</datanucleus.version> 
</properties> 

<profiles> 
    <!-- We can configure our integration server to activate this profile and 
     perform gae:deploy, thus uploading latest snapshot to the http://1.latest.<applicationName>.appspot.com 
     automatically --> 
    <profile> 
     <id>integration-build</id> 
     <properties> 
      <gae.application.version>stage</gae.application.version> 
     </properties> 
    </profile> 

    <!-- This profile will activate automatically during release and upload 
     application to the http://2.latest.<applicationName>.appspot.com (We might 
     want to set the 2nd version as our applications Default version to be accessible 
     at http://<applicationName>.appspot.com) --> 
    <profile> 
     <id>release-build</id> 
     <activation> 
      <property> 
       <name>performRelease</name> 
       <value>true</value> 
      </property> 
     </activation> 

     <properties> 
      <!-- During release, set application version in appengine-web.xml to 
       2 --> 
      <gae.application.version>release</gae.application.version> 
     </properties> 
    </profile> 
</profiles> 

+0

你想在本地資源庫中安裝jar嗎? – MariuszS 2013-04-27 07:25:38

回答

1
在中央回購

最新版本是1.4.1-β

<dependency> 
    <groupId>com.google.api.client</groupId> 
    <artifactId>google-api-client</artifactId> 
    <version>1.4.1-beta</version> 
</dependency> 

下載最新的JAR和本地資源庫

安裝
mvn install:install-file -Dfile=google-api-client.jar -DgroupId=com.google.api.client \ 
    -DartifactId=google-api-client -Dversion=1.6.0-beta -Dpackaging=jar