Coder Social home page Coder Social logo

Comments (5)

oleosterhagen avatar oleosterhagen commented on June 16, 2024 1

In /kieker-monitoring/build.gradle the dependency to kieker-common is included two times:

dependencies {
    implementation project(':kieker-common')
    // ...
    testImplementation project (path: ':kieker-common', configuration: 'testArchives')
    // ...
}

This is no problem when dependencies are included as libraries. (When you close the project kieker-common, Gradle builds the two JAR files which then can be properly referenced by Eclipse.)

But as a project dependency Eclipse supports only one reference to the same project. You could remove the additional test dependency from the classpath when kieker-common is included as a project dependency by adding this to /kieker-monitoring/build.gradle:

plugins {
    id 'java'
    id 'java-library'
    id 'eclipse'
}
//...
eclipse {
    classpath {
        file {
            whenMerged { classpath ->
                classpath.entries.removeAll { entry ->
                    entry instanceof org.gradle.plugins.ide.eclipse.model.ProjectDependency
                        && entry.path == '/kieker-common'
                        && entry.entryAttributes['test']
                }
            }
        }	
    }
}

Now, non-test dependencies from project kieker-monitoring to kieker-common are resolved.

By default, test sources from one Eclipse project are not exposed to other projects (visualized by without test code in the project explorer). To expose the test classes, add this to /kieker-common/build.gradle:

plugins {
    id 'java'
    id 'eclipse'
}
// ...
eclipse {
    classpath {
        containsTestFixtures = true
    }
}

See also #1206

from buildship.

DaGeRe avatar DaGeRe commented on June 16, 2024

Thanks for the hint. For kieker-common and kieker-monitoring, it works to include the whenMerged definition to the classpath.

Just closing the project unfortunately does not work:

grafik

Unfortunately, Kieker contains more modules, and for kieker-analysis, it does not work (I've uploaded the partial fix in https://github.com/kieker-monitoring/kieker/tree/KIEKER-1966-2). Here, we have the same situation with two references to kieker-common, one of them being its testArchives: https://github.com/kieker-monitoring/kieker/blob/bcb811d0cd8a58d2baa4e5d684c35f5f6e0ca6f7/kieker-analysis/build.gradle#L58 This is not recognized correctly, even with the containsTextFixture in /kieker-common/build.gradle and the whenMerged both in /kieker-monitoring/build.gradle and /kieker-analysis/build.gradle:
grafik

Additionally, it seems like the teetime dependencies are not correctly identified: https://github.com/kieker-monitoring/kieker/blob/bcb811d0cd8a58d2baa4e5d684c35f5f6e0ca6f7/kieker-analysis/build.gradle#L62 which results in test classes of teetime being missing:
grafik

This suprises me, since compiling Kieker works fine with just Gradle, but in eclipse, its not possible to build (and I'm sure it worked a year ago - but since I've updated eclipse, it neither works with the currenct nor with older eclipse versions).

from buildship.

oleosterhagen avatar oleosterhagen commented on June 16, 2024

With your changes I can see no more problems in kieker-analysis.

With commit https://github.com/oleosterhagen/kieker/commit/48be0261cf4edb247fc736d5c4cd2801e87cb0a9 I have completed the configuration. The Gradle project should now import without compile errors. (Unfortunately the Java builder picks some files in /kieker-monitoring/test-resources. But this a different issue.)

In some places two project dependencies must be taken into account:

[...]
classpath.entries.removeAll { entry ->
    entry instanceof org.gradle.plugins.ide.eclipse.model.ProjectDependency
        && ['/kieker-common', '/kieker-tools'].contains(entry.path) 
        && entry.entryAttributes['test']
}

When you still have problems and the invocation of Gradle > Refresh Gradle Project does not help, you can try these steps:

  1. Remove the projects from the Eclipse workspace
  2. Delete all .classpath and .project files and all .settings folders
  3. Import the Gradle project again in Eclipse

from buildship.

DaGeRe avatar DaGeRe commented on June 16, 2024

Thanks a lot for the fix! The described problem is fixed by your commit, and we additionally fixed the test-resources problem, so with kieker-monitoring/kieker#419, Kieker is fully buildable with eclipse again.

from buildship.

oleosterhagen avatar oleosterhagen commented on June 16, 2024

@DaGeRe Thank you for your feedback and closing the issue.

When I have some more time, I will try to improve Gradle so that this case is better supported and does not need a manual adjustment of the classpath.

from buildship.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.