<maven> New project packaging encounters Access restriction

1. Error description
Access restriction: The type CommPortIdentifier is not accessible due to restriction on required library D:\Program Files\Java\jdk1.6.0_45\jre\lib\ext\RXTXcomm.jar

Serial programming uses third-party package RXTX , After preventing the dll and package according to the instructions, the development of the import package is normal, but the above error is reported when maven is packaged.

2. To solve the problem
, enter the project's build path->Libraries, then Remove the JRE System Library, then re-Add Library->JRE System Library, and then re-import the error-reported package in the project, and the packaging is normal.

Although solved, the exact reason is still unclear.

It can also be solved as follows:
Global property Project>preferences>java>Compiler>Errors/Warnings> Set the Error of [Deprecated and restricted API>Forbidden reference] on the right to [Warning].
But this is to modify the global property, which is not recommended Revise.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327052012&siteId=291194637