[JavaFX] How to write Eclipse permissions in build.gradle

I get an error every time I gradlew eclipse

image.png

Access restriction: The type 'TransferMode' is not API (restriction on required library 'C:\Program Files\Java\jdk1.8.0_211\jre\lib\ext\jfxrt.jar')

In short, you can give access permission from the following location.

image.png

You can edit it from ** Edit ** on the right of the image above, add ** javafx / \ * \ *** to Accessible with a rule, and allow it. image.png

As expected, the command ** gradlew eclipse ** is hit every time the dependency is updated, so it's annoying to be able to make this setting every time.

It's really annoying when someone clones from git and says "I'm getting an error (laughs)".

So, how to write in gradle.

build.gradle


import org.gradle.plugins.ide.eclipse.model.AccessRule

eclipse {
	classpath {
		file {
			whenMerged {
				def jre = entries.find { it.path.contains 'org.eclipse.jdt.launching.JRE_CONTAINER' }
				jre.accessRules.add(new AccessRule('accessible', 'javafx/**'))
			}
		}
	}
}

Like this. This adds the following to Eclipse's .classpath, which reduces the amount of mouse I use, reduces frustration, reduces war, and makes the world peaceful.

.classpath


	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/">
		<accessrules>
			<accessrule kind="accessible" pattern="javafx/**"/>
		</accessrules>
	</classpathentry>

Thank you always, Stack Overflow guy. Also, [JavaFX] Eclipse, access restriction: The type'?' Is not API (? Ex: JavaFX) and what to do when it comes out @ Smk7758.

Alright, it's about time. I'm going home.

Recommended Posts

[JavaFX] How to write Eclipse permissions in build.gradle
How to run JUnit in Eclipse
[Rails] How to write in Japanese
How to set Lombok in Eclipse
How to include Spring Tool in Eclipse 4.6.3?
[For beginners] How to debug in Eclipse
How to write Rails
How to color code console output in Eclipse
JUnit 5: How to write test cases in enum
To debug in eclipse
How to write dockerfile
How to write docker-compose
How to write Mockito
How to write migrationfile
How to write Java String # getBytes in Kotlin?
Notes on how to write comments in English
How to automatically generate a constructor in Eclipse
Javaer tries to summarize how to write properties in C #
[Ruby on Rails] How to write enum in Japanese
How to switch Tomcat context.xml with WTP in Eclipse
How to use Z3 library in Scala with Eclipse
How to write a date comparison search in Rails
How to use JDD library in Scala with Eclipse
How to Git manage Java EE projects in Eclipse
How to debug the generated jar file in Eclipse
How to write an external reference key in FactoryBot
How to write a core mod in Minecraft Forge 1.15.2
How to write good code
Bit Tetris (how to write)
How to write java comments
[Refactoring] How to write routing
Great poor (how to write)
[Note] How to write Dockerfile/docker-compose.yml
How to write Junit 5 organized
How to use Eclipse Debug_Shell
How to write Rails validation
How to write Rails seed
[Ruby] How to write blocks
How to write Rails routing
How to set character code and line feed code in Eclipse
How to deploy Java application to Alibaba Cloud EDAS in Eclipse
[Rails5] japanMap link How to write parameters in js.erb file
[Rails] How to write user_id (foreign key) in strong parameter
How to use Lombok in Spring
Introduction of javaFX in Eclipse (April 2020)
How to find May'n in XPath
How to hide scrollbars in WebView
How to iterate infinitely in Ruby
Studying Java # 6 (How to write blocks)
How to run Ant in Gradle
How to master programming in 3 months
How to run JavaFX on Docker
How to learn JAVA in 7 days
How to get parameters in Spark
Baseball ball count (how to write)
How to install Bootstrap in Ruby
How to write a ternary operator
How to use InjectorHolder in OpenAM
Rails on Tiles (how to write)
[Rails] How to write exception handling?
[JavaFX] [Java8] How to use GridPane