diff --git a/.mvn/maven.config b/.mvn/maven.config index d912187..2219f51 100644 --- a/.mvn/maven.config +++ b/.mvn/maven.config @@ -1,3 +1,4 @@ -T4 -Dtycho.localArtifacts=ignore -Dtycho.version=5.0.2 +-Dtycho.pomless.parent=${maven.multiModuleProjectDirectory} diff --git a/PomlessAggregator.adoc b/PomlessAggregator.adoc new file mode 100644 index 0000000..1354b59 --- /dev/null +++ b/PomlessAggregator.adoc @@ -0,0 +1,99 @@ += Pomless aggregators with Tycho +:toc: left +:toclevels: 2 +:icons: font +:source-highlighter: rouge + +== What this repository demonstrates + +Tycho's `tycho-build` extension can derive a Maven model for a bundle, feature, product or update site from the files that already describe it, so most modules here have no `pom.xml`. +The same mechanism can also derive an *aggregator*, which is what this repository uses to keep the module list out of the root `pom.xml`. + +Two variants are shown: + +`build/pom.tycho`:: The reactor module list. The root `pom.xml` declares a single module, and the real list lives in a plain text file. +`lsp/pom.tycho`:: A group of related bundles collected in their own folder, listed by an aggregator of their own. + +== How it works + +A folder containing a file named `pom.tycho` is turned into an aggregator with packaging `pom`. +The artifactId is the folder name, and every non-comment line becomes a `` entry. + +.build/pom.tycho +[source] +---- +# "#" comments and blank lines are ignored +../com.vogella.ide.first +../lsp +---- + +Because the lines are used verbatim, they may point outside the aggregator's own folder. +That is what allows `build/` to reference bundles that sit at the repository root. + +The root `pom.xml` keeps everything else it needs to keep, and shrinks to: + +[source,xml] +---- + + build + +---- + +NOTE: A `pom.tycho` is only read in a folder that has no `pom.xml`. +Where both exist the `pom.xml` always wins, so the root pom cannot source its own module list this way. +That is why the indirection through `build/` is needed. + +=== Automatic detection + +If a folder is named `bundles`, `plugins`, `tests`, `features`, `sites`, `products` or `releng`, Tycho scans its subfolders and generates the module list without any file at all. +The list of names is configurable with `-Dtycho.pomless.aggregator.names`. + +This repository deliberately uses an explicit `lsp/pom.tycho` instead, for two reasons. +The folder name `lsp` says what the group is, and an explicit list keeps the ability to disable a single module by commenting out one line. +Automatic detection always takes every subfolder it finds. + +TIP: Tycho writes its generated `pom.tycho` files with a `## tycho automatic module detection ` first line and deletes them when the JVM exits. +A hand-written file simply must not start with that marker. + +== Required configuration + +Two settings make the nested layout work. + +..mvn/maven.config +[source] +---- +-Dtycho.pomless.parent=${maven.multiModuleProjectDirectory} +---- + +By default a pomless module looks for its parent in `..`. +That holds for a bundle at the repository root, but not for one nested inside `lsp/`, which would look in `lsp/` and find nothing. +Pointing the property at the directory that contains `.mvn` makes every pomless module resolve the root pom as its parent, whatever its depth. +`maven.multiModuleProjectDirectory` is resolved by Maven itself, so the setting keeps working when the build is started from a subdirectory. + +The same property can be set per module, as `tycho.pomless.parent` in a bundle's `build.properties`, which takes precedence over the global default. + +.pom.xml +[source,xml] +---- +${maven.multiModuleProjectDirectory}/target-platform/target-platform.target +---- + +The target definition was previously referenced as `../target-platform/target-platform.target`. +That path is resolved against each module's own directory, so it breaks for a module one level deeper. +An absolute path avoids the problem for good. + +== Trade-offs + +The module list is no longer XML, comments are cheaper, and related bundles can be grouped without the root pom growing. +Set against that, the list is no longer where a reader expects it, and `build/` exists only as an indirection. +For a repository with a handful of modules that is a poor trade. +It starts paying off at the scale of this one, where nearly every module is pomless already. + +== Building + +Nothing changes for the caller: + +[source,bash] +---- +./mvnw clean verify +---- diff --git a/build/pom.tycho b/build/pom.tycho new file mode 100644 index 0000000..e394a4c --- /dev/null +++ b/build/pom.tycho @@ -0,0 +1,46 @@ +# The reactor module list. +# +# Tycho's pomless build turns this file into an aggregator (packaging=pom, +# artifactId "build"), so the root pom.xml only needs a single build +# entry instead of one line per bundle. Paths are relative to this folder, +# hence the "../" prefix for everything that lives at the repository root. +# +# "#" comments and blank lines are ignored, which makes temporarily disabling +# a module a one-character edit. + +../com.vogella.ide.first +../com.vogella.ide.feature +../com.vogella.tasks.model +../com.vogella.tasks.services +../com.vogella.tasks.ui +../com.vogella.ide.editor.tasks +../com.vogella.contribute.parts +../com.vogella.swt.widgets +../com.vogella.tasks.events +../com.vogella.eclipse.css + +../com.vogella.resources +../com.vogella.adapters +../com.vogella.tasks.extendedsupplier +../com.vogella.preferences.page +../com.vogella.ide.editor.gradle +../com.vogella.ide.editor.asciidoc +../com.vogella.ide.editor.shell +../com.vogella.ide.debugtools + +# Language server example, grouped in its own folder with its own pom.tycho +../lsp + +../z.ex.search +../com.vogella.ide.iconreplacer +../com.vogella.ide.parallelstart +../com.vogella.json.validation + +# Tests +../com.vogella.json.validation.tests +# ../com.vogella.tasks.services.tests + +../updatesite + +# releng +# ../com.vogella.ide.product diff --git a/com.vogella.lsp.asciidoc.client/.classpath b/lsp/com.vogella.lsp.asciidoc.client/.classpath similarity index 100% rename from com.vogella.lsp.asciidoc.client/.classpath rename to lsp/com.vogella.lsp.asciidoc.client/.classpath diff --git a/com.vogella.lsp.asciidoc.client/.project b/lsp/com.vogella.lsp.asciidoc.client/.project similarity index 100% rename from com.vogella.lsp.asciidoc.client/.project rename to lsp/com.vogella.lsp.asciidoc.client/.project diff --git a/com.vogella.lsp.asciidoc.client/.settings/org.eclipse.core.resources.prefs b/lsp/com.vogella.lsp.asciidoc.client/.settings/org.eclipse.core.resources.prefs similarity index 100% rename from com.vogella.lsp.asciidoc.client/.settings/org.eclipse.core.resources.prefs rename to lsp/com.vogella.lsp.asciidoc.client/.settings/org.eclipse.core.resources.prefs diff --git a/com.vogella.lsp.asciidoc.client/.settings/org.eclipse.jdt.core.prefs b/lsp/com.vogella.lsp.asciidoc.client/.settings/org.eclipse.jdt.core.prefs similarity index 100% rename from com.vogella.lsp.asciidoc.client/.settings/org.eclipse.jdt.core.prefs rename to lsp/com.vogella.lsp.asciidoc.client/.settings/org.eclipse.jdt.core.prefs diff --git a/com.vogella.lsp.asciidoc.client/META-INF/MANIFEST.MF b/lsp/com.vogella.lsp.asciidoc.client/META-INF/MANIFEST.MF similarity index 100% rename from com.vogella.lsp.asciidoc.client/META-INF/MANIFEST.MF rename to lsp/com.vogella.lsp.asciidoc.client/META-INF/MANIFEST.MF diff --git a/com.vogella.lsp.asciidoc.client/build.properties b/lsp/com.vogella.lsp.asciidoc.client/build.properties similarity index 100% rename from com.vogella.lsp.asciidoc.client/build.properties rename to lsp/com.vogella.lsp.asciidoc.client/build.properties diff --git a/com.vogella.lsp.asciidoc.client/plugin.xml b/lsp/com.vogella.lsp.asciidoc.client/plugin.xml similarity index 100% rename from com.vogella.lsp.asciidoc.client/plugin.xml rename to lsp/com.vogella.lsp.asciidoc.client/plugin.xml diff --git a/com.vogella.lsp.asciidoc.client/src/com/vogella/lsp/asciidoc/client/AbstractConnectionProvider.java b/lsp/com.vogella.lsp.asciidoc.client/src/com/vogella/lsp/asciidoc/client/AbstractConnectionProvider.java similarity index 100% rename from com.vogella.lsp.asciidoc.client/src/com/vogella/lsp/asciidoc/client/AbstractConnectionProvider.java rename to lsp/com.vogella.lsp.asciidoc.client/src/com/vogella/lsp/asciidoc/client/AbstractConnectionProvider.java diff --git a/com.vogella.lsp.asciidoc.client/src/com/vogella/lsp/asciidoc/client/ConnectionProviderSolution.java b/lsp/com.vogella.lsp.asciidoc.client/src/com/vogella/lsp/asciidoc/client/ConnectionProviderSolution.java similarity index 100% rename from com.vogella.lsp.asciidoc.client/src/com/vogella/lsp/asciidoc/client/ConnectionProviderSolution.java rename to lsp/com.vogella.lsp.asciidoc.client/src/com/vogella/lsp/asciidoc/client/ConnectionProviderSolution.java diff --git a/com.vogella.lsp.asciidoc.server.tests/.classpath b/lsp/com.vogella.lsp.asciidoc.server.tests/.classpath similarity index 100% rename from com.vogella.lsp.asciidoc.server.tests/.classpath rename to lsp/com.vogella.lsp.asciidoc.server.tests/.classpath diff --git a/com.vogella.lsp.asciidoc.server.tests/.project b/lsp/com.vogella.lsp.asciidoc.server.tests/.project similarity index 100% rename from com.vogella.lsp.asciidoc.server.tests/.project rename to lsp/com.vogella.lsp.asciidoc.server.tests/.project diff --git a/com.vogella.lsp.asciidoc.server.tests/.settings/org.eclipse.jdt.core.prefs b/lsp/com.vogella.lsp.asciidoc.server.tests/.settings/org.eclipse.jdt.core.prefs similarity index 100% rename from com.vogella.lsp.asciidoc.server.tests/.settings/org.eclipse.jdt.core.prefs rename to lsp/com.vogella.lsp.asciidoc.server.tests/.settings/org.eclipse.jdt.core.prefs diff --git a/com.vogella.lsp.asciidoc.server.tests/META-INF/MANIFEST.MF b/lsp/com.vogella.lsp.asciidoc.server.tests/META-INF/MANIFEST.MF similarity index 100% rename from com.vogella.lsp.asciidoc.server.tests/META-INF/MANIFEST.MF rename to lsp/com.vogella.lsp.asciidoc.server.tests/META-INF/MANIFEST.MF diff --git a/com.vogella.lsp.asciidoc.server.tests/build.properties b/lsp/com.vogella.lsp.asciidoc.server.tests/build.properties similarity index 100% rename from com.vogella.lsp.asciidoc.server.tests/build.properties rename to lsp/com.vogella.lsp.asciidoc.server.tests/build.properties diff --git a/com.vogella.lsp.asciidoc.server.tests/manual/Help.adoc b/lsp/com.vogella.lsp.asciidoc.server.tests/manual/Help.adoc similarity index 100% rename from com.vogella.lsp.asciidoc.server.tests/manual/Help.adoc rename to lsp/com.vogella.lsp.asciidoc.server.tests/manual/Help.adoc diff --git a/com.vogella.lsp.asciidoc.server.tests/manual/Testing.adoc b/lsp/com.vogella.lsp.asciidoc.server.tests/manual/Testing.adoc similarity index 100% rename from com.vogella.lsp.asciidoc.server.tests/manual/Testing.adoc rename to lsp/com.vogella.lsp.asciidoc.server.tests/manual/Testing.adoc diff --git a/com.vogella.lsp.asciidoc.server.tests/manual/img/Sample.png b/lsp/com.vogella.lsp.asciidoc.server.tests/manual/img/Sample.png similarity index 100% rename from com.vogella.lsp.asciidoc.server.tests/manual/img/Sample.png rename to lsp/com.vogella.lsp.asciidoc.server.tests/manual/img/Sample.png diff --git a/com.vogella.lsp.asciidoc.server.tests/manual/img/Test.png b/lsp/com.vogella.lsp.asciidoc.server.tests/manual/img/Test.png similarity index 100% rename from com.vogella.lsp.asciidoc.server.tests/manual/img/Test.png rename to lsp/com.vogella.lsp.asciidoc.server.tests/manual/img/Test.png diff --git a/com.vogella.lsp.asciidoc.server.tests/src/com/vogella/lsp/asciidoc/server/tests/AsciidocCompletionTest.java b/lsp/com.vogella.lsp.asciidoc.server.tests/src/com/vogella/lsp/asciidoc/server/tests/AsciidocCompletionTest.java similarity index 100% rename from com.vogella.lsp.asciidoc.server.tests/src/com/vogella/lsp/asciidoc/server/tests/AsciidocCompletionTest.java rename to lsp/com.vogella.lsp.asciidoc.server.tests/src/com/vogella/lsp/asciidoc/server/tests/AsciidocCompletionTest.java diff --git a/com.vogella.lsp.asciidoc.server.tests/src/com/vogella/lsp/asciidoc/server/tests/AsciidocDefinitionTest.java b/lsp/com.vogella.lsp.asciidoc.server.tests/src/com/vogella/lsp/asciidoc/server/tests/AsciidocDefinitionTest.java similarity index 100% rename from com.vogella.lsp.asciidoc.server.tests/src/com/vogella/lsp/asciidoc/server/tests/AsciidocDefinitionTest.java rename to lsp/com.vogella.lsp.asciidoc.server.tests/src/com/vogella/lsp/asciidoc/server/tests/AsciidocDefinitionTest.java diff --git a/com.vogella.lsp.asciidoc.server.tests/src/com/vogella/lsp/asciidoc/server/tests/AsciidocDocumentLinkTest.java b/lsp/com.vogella.lsp.asciidoc.server.tests/src/com/vogella/lsp/asciidoc/server/tests/AsciidocDocumentLinkTest.java similarity index 100% rename from com.vogella.lsp.asciidoc.server.tests/src/com/vogella/lsp/asciidoc/server/tests/AsciidocDocumentLinkTest.java rename to lsp/com.vogella.lsp.asciidoc.server.tests/src/com/vogella/lsp/asciidoc/server/tests/AsciidocDocumentLinkTest.java diff --git a/com.vogella.lsp.asciidoc.server.tests/src/com/vogella/lsp/asciidoc/server/tests/AsciidocHoverTest.java b/lsp/com.vogella.lsp.asciidoc.server.tests/src/com/vogella/lsp/asciidoc/server/tests/AsciidocHoverTest.java similarity index 100% rename from com.vogella.lsp.asciidoc.server.tests/src/com/vogella/lsp/asciidoc/server/tests/AsciidocHoverTest.java rename to lsp/com.vogella.lsp.asciidoc.server.tests/src/com/vogella/lsp/asciidoc/server/tests/AsciidocHoverTest.java diff --git a/com.vogella.lsp.asciidoc.server/.classpath b/lsp/com.vogella.lsp.asciidoc.server/.classpath similarity index 100% rename from com.vogella.lsp.asciidoc.server/.classpath rename to lsp/com.vogella.lsp.asciidoc.server/.classpath diff --git a/com.vogella.lsp.asciidoc.server/.project b/lsp/com.vogella.lsp.asciidoc.server/.project similarity index 100% rename from com.vogella.lsp.asciidoc.server/.project rename to lsp/com.vogella.lsp.asciidoc.server/.project diff --git a/com.vogella.lsp.asciidoc.server/.settings/org.eclipse.core.resources.prefs b/lsp/com.vogella.lsp.asciidoc.server/.settings/org.eclipse.core.resources.prefs similarity index 100% rename from com.vogella.lsp.asciidoc.server/.settings/org.eclipse.core.resources.prefs rename to lsp/com.vogella.lsp.asciidoc.server/.settings/org.eclipse.core.resources.prefs diff --git a/com.vogella.lsp.asciidoc.server/.settings/org.eclipse.jdt.core.prefs b/lsp/com.vogella.lsp.asciidoc.server/.settings/org.eclipse.jdt.core.prefs similarity index 100% rename from com.vogella.lsp.asciidoc.server/.settings/org.eclipse.jdt.core.prefs rename to lsp/com.vogella.lsp.asciidoc.server/.settings/org.eclipse.jdt.core.prefs diff --git a/com.vogella.lsp.asciidoc.server/META-INF/MANIFEST.MF b/lsp/com.vogella.lsp.asciidoc.server/META-INF/MANIFEST.MF similarity index 100% rename from com.vogella.lsp.asciidoc.server/META-INF/MANIFEST.MF rename to lsp/com.vogella.lsp.asciidoc.server/META-INF/MANIFEST.MF diff --git a/com.vogella.lsp.asciidoc.server/build.properties b/lsp/com.vogella.lsp.asciidoc.server/build.properties similarity index 100% rename from com.vogella.lsp.asciidoc.server/build.properties rename to lsp/com.vogella.lsp.asciidoc.server/build.properties diff --git a/com.vogella.lsp.asciidoc.server/icons/info.svg b/lsp/com.vogella.lsp.asciidoc.server/icons/info.svg similarity index 100% rename from com.vogella.lsp.asciidoc.server/icons/info.svg rename to lsp/com.vogella.lsp.asciidoc.server/icons/info.svg diff --git a/com.vogella.lsp.asciidoc.server/src/com/vogella/lsp/asciidoc/server/AsciidocDocumentModel.java b/lsp/com.vogella.lsp.asciidoc.server/src/com/vogella/lsp/asciidoc/server/AsciidocDocumentModel.java similarity index 100% rename from com.vogella.lsp.asciidoc.server/src/com/vogella/lsp/asciidoc/server/AsciidocDocumentModel.java rename to lsp/com.vogella.lsp.asciidoc.server/src/com/vogella/lsp/asciidoc/server/AsciidocDocumentModel.java diff --git a/com.vogella.lsp.asciidoc.server/src/com/vogella/lsp/asciidoc/server/AsciidocElements.java b/lsp/com.vogella.lsp.asciidoc.server/src/com/vogella/lsp/asciidoc/server/AsciidocElements.java similarity index 100% rename from com.vogella.lsp.asciidoc.server/src/com/vogella/lsp/asciidoc/server/AsciidocElements.java rename to lsp/com.vogella.lsp.asciidoc.server/src/com/vogella/lsp/asciidoc/server/AsciidocElements.java diff --git a/com.vogella.lsp.asciidoc.server/src/com/vogella/lsp/asciidoc/server/AsciidocLanguageServer.java b/lsp/com.vogella.lsp.asciidoc.server/src/com/vogella/lsp/asciidoc/server/AsciidocLanguageServer.java similarity index 100% rename from com.vogella.lsp.asciidoc.server/src/com/vogella/lsp/asciidoc/server/AsciidocLanguageServer.java rename to lsp/com.vogella.lsp.asciidoc.server/src/com/vogella/lsp/asciidoc/server/AsciidocLanguageServer.java diff --git a/com.vogella.lsp.asciidoc.server/src/com/vogella/lsp/asciidoc/server/AsciidocTextDocumentService.java b/lsp/com.vogella.lsp.asciidoc.server/src/com/vogella/lsp/asciidoc/server/AsciidocTextDocumentService.java similarity index 100% rename from com.vogella.lsp.asciidoc.server/src/com/vogella/lsp/asciidoc/server/AsciidocTextDocumentService.java rename to lsp/com.vogella.lsp.asciidoc.server/src/com/vogella/lsp/asciidoc/server/AsciidocTextDocumentService.java diff --git a/com.vogella.lsp.asciidoc.server/src/com/vogella/lsp/asciidoc/server/AsciidocWorkspaceService.java b/lsp/com.vogella.lsp.asciidoc.server/src/com/vogella/lsp/asciidoc/server/AsciidocWorkspaceService.java similarity index 100% rename from com.vogella.lsp.asciidoc.server/src/com/vogella/lsp/asciidoc/server/AsciidocWorkspaceService.java rename to lsp/com.vogella.lsp.asciidoc.server/src/com/vogella/lsp/asciidoc/server/AsciidocWorkspaceService.java diff --git a/com.vogella.lsp.asciidoc.server/src/com/vogella/lsp/asciidoc/server/Main.java b/lsp/com.vogella.lsp.asciidoc.server/src/com/vogella/lsp/asciidoc/server/Main.java similarity index 100% rename from com.vogella.lsp.asciidoc.server/src/com/vogella/lsp/asciidoc/server/Main.java rename to lsp/com.vogella.lsp.asciidoc.server/src/com/vogella/lsp/asciidoc/server/Main.java diff --git a/lsp/pom.tycho b/lsp/pom.tycho new file mode 100644 index 0000000..d9cb9c2 --- /dev/null +++ b/lsp/pom.tycho @@ -0,0 +1,12 @@ +# Modules of the "lsp" aggregator. +# +# This file replaces an lsp/pom.xml. Tycho's pomless build reads it and +# generates an aggregator with packaging=pom and artifactId "lsp" (the folder +# name). One module per line, "#" comments and blank lines are ignored. +# +# An explicit list is required here because "lsp" is not one of the folder +# names Tycho scans automatically (bundles, plugins, tests, features, sites, +# products, releng). +com.vogella.lsp.asciidoc.client +com.vogella.lsp.asciidoc.server +com.vogella.lsp.asciidoc.server.tests diff --git a/pom.xml b/pom.xml index c802d21..b1ebd95 100644 --- a/pom.xml +++ b/pom.xml @@ -89,7 +89,7 @@ ${tycho.version} - ../target-platform/target-platform.target + ${maven.multiModuleProjectDirectory}/target-platform/target-platform.target JavaSE-25 @@ -115,43 +115,7 @@ - com.vogella.ide.first - com.vogella.ide.feature - com.vogella.tasks.model - com.vogella.tasks.services - com.vogella.tasks.ui - com.vogella.ide.editor.tasks - com.vogella.contribute.parts - com.vogella.swt.widgets - com.vogella.tasks.events - com.vogella.eclipse.css - - com.vogella.resources - com.vogella.adapters - com.vogella.tasks.extendedsupplier - com.vogella.preferences.page - com.vogella.ide.editor.gradle - com.vogella.ide.editor.asciidoc - com.vogella.ide.editor.shell - com.vogella.ide.debugtools - com.vogella.lsp.asciidoc.client - com.vogella.lsp.asciidoc.server - com.vogella.lsp.asciidoc.server.tests - z.ex.search - com.vogella.ide.iconreplacer - com.vogella.ide.parallelstart - com.vogella.json.validation - - - com.vogella.json.validation.tests - - updatesite - - - - + + build \ No newline at end of file