maven-enforcer-plugin (goal “enforce”) is ignored by m2e.
http://blog.csdn.net/jdwl20090304/article/details/40107269
maven打包可运行的JAR
http://blog.163.com/coffee_hc/blog/static/4485331920121274422988/
java运行jar命令提示没有主清单属性
http://jingyan.baidu.com/article/db55b60990f6084ba30a2fb8.html
打包时跳过test
http://www.cnblogs.com/lixuwu/p/5941363.html
解决Maven报Plugin execution not covered by lifecycle configuration
http://blog.csdn.net/xxd851116/article/details/25197373
Java/Scala混合项目maven打包
mvn clean scala:compile compile package
Maven打包过程中跳过测试
http://blog.csdn.net/redstarofsleep/article/details/46518585
maven冲突
package macros contains object and package with same name:blackbox one of them needs to be removed from classpath
这有可能是scala中的Object和添加的依赖有冲突,比如,本次遇到的冲突就是和下面的依赖有冲突,跟scope标签没关系,也跟scala编译器的配置没关系
<!-- https://mvnrepository.com/artifact/org.apache.spark/spark-mllib_2.10 -->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-mllib_2.10</artifactId>
<version>2.2.0</version>
<scope>provided</scope>
</dependency>
请使用 -source 7 或更高版本以启用 diamond 运算符
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
<executions>
<execution>
<id>default-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>default-testCompile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
maven-assembly-plugin
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>org.neo4j.test.Neo4jTest</mainClass>
</manifest>
</archive>
</configuration>
<!-- <executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions> -->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>jar-with-dependencies</id>
<phase>package</phase>
<!-- <goals>
<goal>single</goal>
</goals> -->
<configuration>
<descriptors>
<descriptor>src/assembly/jar-assembly.xml</descriptor>
</descriptors>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>org.neo4j.test.Neo4jTest</mainClass>
</manifest>
</archive>
</configuration>
</execution>
</executions>
</plugin>
maven 打包后,通过可以得到src/main/resources
下的资源,这是将src/main/resources
下的资源打入jar包后,通过以下方法得到
PropertyConfigurator.configure(this.getClass().getClassLoader().getResource("log4j.properties"));
如果maven打包后,没有把src/main/resources
下的资源打入jar包,从另外的配置文件读取,是这样的,读取的jar里的
String path="conf/log4j.properties";
InputStream in=this.getClass().getClassLoader().getResourceAsStream(path);