maven记录

maven排除传递的依赖

 <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-core</artifactId>
            <version>${struts2.version}</version>
            <!-- 排除传递的依赖 -->
            <exclusions>
                <exclusion>
                    <artifactId>javassist</artifactId>
                    <groupId>javassist</groupId>
                </exclusion>
            </exclusions>
        </dependency>
Missing artifact javax.servlet.jsp.jstl:jstl:jar:1.2报错
原pom文件:

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>

</dependency>

新:
		<!-- jstl -->
		<dependency>
			<groupId>javax.servlet.jsp.jstl</groupId>
			<artifactId>jstl-api</artifactId>
			<version>1.2</version>
			<exclusions>
				<exclusion>
					<groupId>javax.servlet</groupId>
					<artifactId>servlet-api</artifactId>
				</exclusion>
				<exclusion>
					<groupId>javax.servlet.jsp</groupId>
					<artifactId>jsp-api</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.glassfish.web</groupId>
			<artifactId>jstl-impl</artifactId>
			<version>1.2</version>
			<exclusions>
				<exclusion>
					<groupId>javax.servlet</groupId>
					<artifactId>servlet-api</artifactId>
				</exclusion>
				<exclusion>
					<groupId>javax.servlet.jsp</groupId>
					<artifactId>jsp-api</artifactId>
				</exclusion>
				<exclusion>
					<groupId>javax.servlet.jsp.jstl</groupId>
					<artifactId>jstl-api</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

maven单个项目加指定仓库

<!--仓库配置 -->
<repositories>
		<repository>
			<!--唯一id-->
			<id>public</id>
			<!--解释 -->
			<name>aliyun nexus</name>
			<!--仓库地址 -->
			<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
			<!--仓库releases版本包可下载-->
			<releases>
				<enabled>true</enabled>
			</releases>
			<!--仓库snapshots版本包不可下载 -->
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
		</repository>
	</repositories>
	<!--插件仓库配置 -->
	<pluginRepositories>
		<pluginRepository>
		<!--唯一id-->
			<id>public</id>
			<!--解释 -->
			<name>aliyun nexus</name>
			<!--仓库地址 -->
			<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
			<!--仓库releases版本包可下载-->
			<releases>
				<enabled>true</enabled>
			</releases>
			<!--仓库snapshots版本包不可下载 -->
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
		</pluginRepository>
	</pluginRepositories>

maven报错json-lib包,要加classifier来分辨

		<dependency>
        	<groupId>net.sf.json-lib</groupId>
        	<artifactId>json-lib</artifactId>
        	<version>2.4</version>
        	<classifier>jdk15</classifier> 
        </dependency>
<!-- 引入tomcat插件 -->
<plugins>
  		<plugin>
  			<groupId>org.apache.tomcat.maven</groupId>
  			<artifactId>tomcat7-maven-plugin</artifactId>
  			<version>2.2</version>
  			<configuration>
					<path>/bos</path>
					<port>8888</port>
			</configuration>
  		</plugin>
  	</plugins>
<!--编译插件注意配置-->
<plugins>
  		<plugin>
  			<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>2.3.2</version>
				<configuration> 
					 <!-- 源代码使用的jdk版本 -->
	                 <source>1.7</source>
	                 <!-- 构建后生成class文件jdk版本 -->
	                 <target>1.7</target>
				</configuration>
  		</plugin>
  	</plugins>
通过maven下载源代码,直接通过eclipse浏览源代码时,发现中文注释为乱码的问题。其实这个eclipse默认编码造成的问题。可以通过以下方法解决:


    修改Eclipse中文本文件的默认编码:windows->Preferences->general->Workspace->Text file encoding设置为UTF-8
    修改JAVA源文件的默认编码:windows->Preferences->general->Content Types->右侧Context Types树,点开Text,选择Java Source File,在下面的Default encoding输入框中输入UTF-8,点Update;

如果还是乱码,记得重启eclipse 。
--------------------- 
作者:yangzongzhuan 
来源:CSDN 
原文:https://blog.csdn.net/ffggnfgf/article/details/81056956 
版权声明:本文为博主原创文章,转载请附上博文链接!
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值