maven的QA

stackoverflow.com

1. org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER

Q:

Classpath entry org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER will not be exported or published. Runtime ClassNotFoundExceptions may result.  

A:

$mvn eclipse:clean

reference

2. no main manifest attribute java jar

Q:

$java -jar cliDemo-0.0.1-SNAPSHOT.jar
no main manifest attribute, in cliDemo-0.0.1-SNAPSHOT.jar

A:

for win:

java -cp cliDemo-0.0.1-SNAPSHOT.jar;C:\Users\xiaobin\.m2\repository\commons-cli\commons-cli\1.4\commons-cli-1.4.jar my.csdn9.ConsoleLauncher --help

Reference

3. CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin

Q:

CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved: Failure to find org.apache.maven.plugins:maven-compiler-plugin:jar:3.1 in http://repository.jboss.org/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of jboss-public-repository-group has elapsed or updates are forced

A: 找到maven库目录,进入:~.m2\repository\org\apache\maven\plugins\maven-compiler-plugin
删除3.1文件夹

Reference

4. Proxy

conf/settings.xml

  <!-- proxies
   | This is a list of proxies which can be used on this machine to connect to the network.
   | Unless otherwise specified (by system property or command-line switch), the first proxy
   | specification in this list marked as active will be used.
   |-->
  <proxies>
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>127.0.0.1</host>
      <port>8580</port>
    </proxy>
  </proxies>

5. How to add Oracle JDBC driver in your Maven local repository

down ojdbc6.jar

exec

mvn install:install-file -Dfile=D:/war/lib/ojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar

pom.xml

<!-- ojdbc6.jar example -->
<dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc6</artifactId>
    <version>11.2.0</version>
</dependency>