Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IntelliJ IDEA import fails because it is not honoring gradle.properties #30

Open
chali opened this issue Aug 24, 2018 · 6 comments
Open
Labels

Comments

@chali
Copy link
Member

chali commented Aug 24, 2018

We are enabling experimental features via system properties which are set in gradle.properties Those properties are read in different places. One of them is in init script. However, when IntelliJ is importing gradle project it is setting properties from gradle.properties too late and init script is already executed. Example project showing this case https://github.com/nebula-plugins/gradle-nebula-integration/tree/master/broken-intellij-import-with-native-lock

How to reproduce

  • Assuming that you are in project directory cp init.gradle ~/.gradle/init.d/
  • ./gradlew dependencies --write-locks
  • idea . (assuming that you have IntelliJ command line launcher)
  • Click OK to finish import.

Project import fails with:

Caused by: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':resolutionRulesCopy'.
	at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingConfigurationResolver.wrapException(ErrorHandlingConfigurationResolver.java:103)
	at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingConfigurationResolver.resolveGraph(ErrorHandlingConfigurationResolver.java:75)
	at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$5.run(DefaultConfiguration.java:533)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
	at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
	at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveGraphIfRequired(DefaultConfiguration.java:524)
	at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveToStateOrLater(DefaultConfiguration.java:509)
	at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.access$1800(DefaultConfiguration.java:123)
	at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getSelectedArtifacts(DefaultConfiguration.java:1037)
	at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getFiles(DefaultConfiguration.java:1025)
	at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getFiles(DefaultConfiguration.java:444)
	at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.getFiles(Unknown Source)
	at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolve(DefaultConfiguration.java:434)
	at nebula.plugin.resolutionrules.CopiedConfiguration.resolve(configurations.kt)
	at nebula.plugin.resolutionrules.NebulaResolutionRulesExtension$ruleFiles$2.invoke(plugin.kt:172)
	at nebula.plugin.resolutionrules.NebulaResolutionRulesExtension$ruleFiles$2.invoke(plugin.kt:164)
	at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
	at nebula.plugin.resolutionrules.NebulaResolutionRulesExtension.getRuleFiles(plugin.kt)
	at nebula.plugin.resolutionrules.NebulaResolutionRulesExtension.ruleFiles(plugin.kt:178)
	at nebula.plugin.resolutionrules.ResolutionRulesPlugin.rulesFromConfiguration(plugin.kt:105)
	at nebula.plugin.resolutionrules.ResolutionRulesPlugin.access$rulesFromConfiguration(plugin.kt:36)
	at nebula.plugin.resolutionrules.ResolutionRulesPlugin$ruleSet$2.invoke(plugin.kt:39)
	at nebula.plugin.resolutionrules.ResolutionRulesPlugin$ruleSet$2.invoke(plugin.kt:36)
	at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
	at nebula.plugin.resolutionrules.ResolutionRulesPlugin.getRuleSet(plugin.kt)
	at nebula.plugin.resolutionrules.ResolutionRulesPlugin.access$getRuleSet$p(plugin.kt:36)
	at nebula.plugin.resolutionrules.ResolutionRulesPlugin$apply$1$$special$$inlined$onExecute$1.execute(projects.kt:19)
	at nebula.plugin.resolutionrules.ResolutionRulesPlugin$apply$1$$special$$inlined$onExecute$1.execute(projects.kt)
	at org.gradle.configuration.internal.DefaultListenerBuildOperationDecorator$BuildOperationEmittingAction$1$1.run(DefaultListenerBuildOperationDecorator.java:155)
	at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.reapply(DefaultUserCodeApplicationContext.java:58)
	at org.gradle.configuration.internal.DefaultListenerBuildOperationDecorator$BuildOperationEmittingAction$1.run(DefaultListenerBuildOperationDecorator.java:152)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
	at org.gradle.configuration.internal.DefaultListenerBuildOperationDecorator$BuildOperationEmittingAction.execute(DefaultListenerBuildOperationDecorator.java:149)
	at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:91)
	at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:80)
	at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:42)
	at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:230)
	at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:149)
	at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58)
	... 105 more
Caused by: org.gradle.internal.locking.LockOutOfDateException: Dependency lock state for configuration 'resolutionRules' is out of date: Resolved 'io.spring.platform:platform-bom:1.0.1.RELEASE' which is not part of the lock state
	at org.gradle.internal.locking.LockOutOfDateException.createLockOutOfDateException(LockOutOfDateException.java:37)
	at org.gradle.internal.locking.DependencyLockingArtifactVisitor.throwLockOutOfDateException(DependencyLockingArtifactVisitor.java:153)
	at org.gradle.internal.locking.DependencyLockingArtifactVisitor.complete(DependencyLockingArtifactVisitor.java:159)
	at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.CompositeDependencyArtifactsVisitor.complete(CompositeDependencyArtifactsVisitor.java:73)
	at org.gradle.api.internal.artifacts.ivyservice.DefaultConfigurationResolver.resolveGraph(DefaultConfigurationResolver.java:178)
	at org.gradle.api.internal.artifacts.ivyservice.ShortCircuitEmptyConfigurationResolver.resolveGraph(ShortCircuitEmptyConfigurationResolver.java:89)
	at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingConfigurationResolver.resolveGraph(ErrorHandlingConfigurationResolver.java:73)
	... 148 more

Looking at IntelliJ IDEA import process logging shows that flag for coreBomSupport is false hence it didn't exclude resolutionRules from recommending and so recommender adds bom into it. Because lock was generated from command line where it was excluded it causes missmatch.

Flag read in init script false //read from system property nebula.features.coreBomSupport

> Configure project :
coreBomSupport feature enabled //read from system property nebula.features.coreBomSupport
example-project: coreAlignmentSupport feature enabled
@chali
Copy link
Member Author

chali commented Aug 24, 2018

Is it a Gradle or IntelliJ issue?

@oehme
Copy link

oehme commented Aug 27, 2018

If IntelliJ uses setJvmArgs, that'll overwrite anything in your gradle.properties. You could check that by seeing if the daemon actually got the 2g you wanted. Maybe you have some JVM args set in IntelliJ or maybe IntelliJ is always calling that method even if the user didn't set any?

@chali
Copy link
Member Author

chali commented Aug 29, 2018

So I added org.gradle.jvmargs=-Xmx2001m into my gradle.properties and I can see daemon having it. I don't have any Gradle VM Options set in IntelliJ's configuration of Gradle.

@oehme
Copy link

oehme commented Sep 14, 2018

We've gotten similar reports on the forum about certain JVM args not being honoured. We should investigate whether this is a bug in the tooling API. Can you open a bug on the gradle/gradle issue tracker?

@chali
Copy link
Member Author

chali commented Sep 14, 2018

Thanks, @oehme looking into it. I will create an issue.

@chali
Copy link
Member Author

chali commented Sep 19, 2018

Better late then later :( gradle/gradle#6825

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants