Sun's *java compiler* detects when a special "internal" class is being accessed, and refuses to import the class. Eclipse uses a different compiler which presumably does not have this check. Maven just uses the javac compiler available in the system execution path. Therefore the problem is nothing to do with Maven at all. It's the compiler that maven is invoking which is refusing to compile the source. I can't see any public flags in the javac commandline to disable this "blocking" of internal access, so unless you want to avoid using Sun's javac compiler you'll just have to avoid using this internal class.
为什么使用rt.jar的内部类,在eclipse运行没问题,而在mvn编译的时候失败呢?
maven 编译的时候,默认使用jdk的javac进行编译,javac本身是不支持访问内部类的
而在eclipse中编译没问题,也可以运行成功,那是因为在eclipse中它的编译器是eclipse自己写的
并没做这样的限制
所以把mvn的编译器换成eclipse的实现应该就ok了
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <compilerId>eclipse</compilerId> <source>1.6</source> <target>1.6</target> <optimize>true</optimize> <verbose>false</verbose> <useIncrementalCompilation>false</useIncrementalCompilation> <showWarnings>false</showWarnings> <showDeprecation>false</showDeprecation> <debug>false</debug> </configuration> <dependencies> <dependency> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-compiler-eclipse</artifactId> <!---2.2 org.eclipse.jdt.core-3.8.1.v20120531-0637 --> <!---2.1 org.eclipse.jdt.core-3.8.1.v20120531-0637 --> <version>2.2</version> </dependency> </dependencies> </plugin>
相关推荐
hudi编译失败,不能通过maven自动下载的jar包,包括: pentaho-aggdesigner-algorithm-5.1.5-jhyde.jar, kafka-schema-registry-client-5.3.4.jar,kafka-avro-serializer-5.3.4.jar,common-utils-5.3.4.jar,common-...
通过bat 简单实现 导出exlipase里mvn项目里的jar包
c3p0-0.9.5.2.jar mchange-commons-java-0.2.11.jar commons-logging-1.2.jar mysql-connector-java-5.1.43-bin.jar
可以添加本地依赖通过命令mvn install:install-file -Dfile=C:\Users\spire.doc-5.4.0.jar -DgroupId=e-iceblue -DartifactId=spire.doc -Dversion=5.4.0 -Dpackaging=jar将该依赖添加到本地依赖库使用,其他添加到...
1.sapjco3.dll 需要与 sapjco3.jar 在同一目录 2.设置系统环境变量,将sapjco3所在目录加入系统环境变量 3.根据自己的操作系统版本选择对应的sapjco3包 32位系统 例如: 新建环境变量 变量名: JAVA_SAPJCO 变量...
资源包xxxx.jar真实,自己按照下面模式: oracle6.jar, oracle7.jar, oracle8.jar, oracle10.jar,安装至Maven下, ojdbc6.jar仅为示例: <groupId>com.oracle</groupId> <artifactId>ojdbc6 <version>12.1.0.1-...
java音频开发.mp3文件解码jmp123.jar
spring-beans-3.2.8.RELEASE.jar
资源包xxxx.jar真实,自己按照下面模式: oracle6.jar, oracle7.jar, oracle8.jar, oracle10.jar,安装至Maven下, ojdbc6.jar仅为示例: <groupId>com.oracle</groupId> <artifactId>ojdbc6 <version>12.1.0.1-...
org.eclipse.jetty.io_9.1.1.v20140108.jar org.eclipse.jetty.util_9.1.1.v20140108.jar org.eclipse.jetty.websocket.api_9.1.1.v20140108.jar org.eclipse.jetty.websocket.client_9.1.1.v20140108.jar org....
maven下载QRCode.jar包
mvn install:install-file -Dfile=文件路径\spire.pdf.free-2.2.2.jar -DgroupId=e-iceblue -DartifactId=spire.pdf.free -Dversion=2.2.2 -Dpackaging=jar mvn install:install-file -Dfile=文件路径\spire.xls....
下载之后再maven的bin目录下使用mvn命令:mvn install:install-file -Dfile=F:\apache-maven-3.5.3\mylib\olap4j-0.9.7.309-JS-3.jar -DgroupId=org.olap4j -DartifactId=olap4j-0.9.7.309-JS-3 -Dversion=0.9.7.309...
资源包xxxx.jar真实,自己按照下面模式: oracle6.jar, oracle7.jar, oracle8.jar, oracle10.jar,安装至Maven下, ojdbc6.jar仅为示例: <groupId>com.oracle</groupId> <artifactId>ojdbc6 <version>12.1.0.1-...
因为在授权问题。maven不能下载,下载这个驱动包以后。在cmd里面执行mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion=12.1.0.1 -Dpackaging=jar -Dfile=D:\maven\repository\ojdbc7-...
javax.imageio-1.0.5.jar, java处理图片的库。 从maven中央仓库下载的。实测可用。
资源包xxxx.jar真实,自己按照下面模式: oracle6.jar, oracle7.jar, oracle8.jar, oracle10.jar,安装至Maven下, ojdbc6.jar仅为示例: <groupId>com.oracle</groupId> <artifactId>ojdbc6 <version>12.1.0.1-...
maven工程下qrcode jar包下载失败,提供两个qrcode.jar QRCode_swetake-3.0.0.jar 包,cmd命令行安装方法,maven手动添加jar包 qrcode.jar QRCode_swetake-3.0.0.jar
可以添加本地依赖通过命令mvn install:install-file -Dfile=C:\Users\spire.doc-5.4.10.jar -DgroupId=e-iceblue -DartifactId=spire.doc -Dversion=5.4.10 -Dpackaging=jar将该依赖添加到本地依赖库使用,其他添加...
资源包xxxx.jar真实,自己按照下面模式: oracle6.jar, oracle7.jar, oracle8.jar, oracle10.jar,安装至Maven下, ojdbc6.jar仅为示例: <groupId>com.oracle</groupId> <artifactId>ojdbc6 <version>12.1.0.1-...