This message was deleted.
# community-support
s
This message was deleted.
v
I don't think so. If a plugin is not present this can change the whole semantics of the build. I strongly recommend you not try to do that.
Having said that, you could probably use the legacy way to apply the plugin and before applying check whether the class of the plugin can be found.
But really, don't do that. 🙂
👍 1
y
let’s say that
my-awesome-plugin
is in a private repo that i need vpn to login to. and this plugin does not affect the build in any way, but gives extra tasks that my org needs in the ci/cd. and i don’t need it/can’t get to the private repo while development . i know it’s a very bad practice. but its still something i was wondering about
a
you could try and copy the plugin Maven Local, and add Maven Local as a plugin repository?
y
i guess so. but it was more of a theoretical question.
a
do you have access to the
my-awesome-plugin
source code? You could check it out and set up a composite build (add it as an
includedBuild()
), then Gradle should substitute it or maybe write some complicated custom resolution rule that would replace the
my-awsome-plugin
plugin marker artifact with the Gradle Base Plugin marker artifact
y
intresting! ill give it a look! thanks
👍 1
am i doing this rigght? in the repositories:
Copy code
mavenLocal {
            uri("/tmp/derp/location")
        }
(apperantly we have global m2 cache.)
a
Maven Local is a fixed location, which defaults to
$USER_HOME/.m2
. You can change it, but not via Gradle configuration.
y
in the settings.xml?
a
there’s a few ways of changing it, I think one is via a system property, and another is in some Maven settings.xml… Either way, Gradle should pick that up automatically
y
i’m looking into this so question
a
if you wanted you could just manually add the repository directory, using a regular
maven {}
definition
Copy code
repositories {
    maven {
        url = file("/path/to/repo")
    }
}
but if you’re using Kotlin DSL, I’d define it like this, and then it’s usually a good idea to add a name
Copy code
repositories {
    maven(file("/path/to/repo")) {
      name = "MyLocalRepo"
    }
}
v
and this plugin does not affect the build in any way, but gives extra tasks that my org needs in the ci/cd.
Then you could just do what I said roughly. Use the legacy applying by adding to build script classpath and calling
apply
and make both actions in an
if
that checks somehow whether that repository is available or not. But make sure you don't have to wait for some "long" connection timeout when not in VPN.
Having that plugin in some local repository might be bad if it then builds differently because you have different plugin version.
But actually, you should probably just not apply that plugin at all in the regular build
Instead make your CI/CD have some init script that applies that plugin, so it is exactly applied when CI/CD is used.
That also saves you the time for applying it even when building with VPN