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

OAK-9896 - Running unit-tests in IntelliJ dos not work #664

Merged
merged 2 commits into from Aug 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 32 additions & 0 deletions oak-parent/pom.xml
Expand Up @@ -1316,5 +1316,37 @@
</pluginManagement>
</build>
</profile>
<profile>
<id>intellij-build-workaround</id>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it a bit nasty that this workaround profile is actually containing the default configuration when it is not running in IntelliJ. Can we rather leave the default in place without any profile, and override only for IntelliJ (with this profile)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with you in principle. The problem is that I don't know how to remove the _plugin.scr instruction once it's configured. Do you know of a way to achieve that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the pointer! Please have a look at the revised change.

<!-- workaround for IntelliJ issue https://youtrack.jetbrains.com/issue/IDEA-141732/OSMORC-unable-to-load-bnd-plugin -->
<!-- IntelliJ does not add the plugin's extra dependency to the plugin's class-path, which causes the build to fail. -->
<!-- This means unit-tests cannot be run from within the IDE. Removing the _plugin instruction from the config if -->
<!-- the IntelliJ specific property "idea.maven.embedder.version" is present resolves the issue. In order for all -->
<!-- tests to work properly, a maven build may need to be run first, in order to generate SCR configuration files -->
<!-- from the "old" Felix OSGi annotations. The newer annotations from the OSGi DS specification are supported ootb -->
<!-- by bnd and thus by the maven-bundle-plugin. -->
<activation>
<property>
<name>idea.maven.embedder.version</name>
</property>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<_plugin combine.self="override">
<!-- remove the _plugin instruction that causes Intellij IDEA to fail when running unit-tests -->
</_plugin>
</instructions>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>
</project>