maven-enforcer-plugin (goal “enforce”) is ignored by m2e.

maven打包可运行的JAR

java运行jar命令提示没有主清单属性

打包时跳过test

解决Maven报Plugin execution not covered by lifecycle configuration

Java/Scala混合项目maven打包

mvn clean scala:compile compile package

Maven打包过程中跳过测试

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);

maven 使用_javascript