-
Notifications
You must be signed in to change notification settings - Fork 34
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
Unable to 'edit starters' in child project #110
Comments
Current logic to judge a valid spring-boot project is simple and naive. It simply parse the pom file, and the condition is: parent.groupId == "org.springframework.boot" && parent.artifactId == "spring-boot-starter-parent" Any simple and effective way to identify a spring-boot project? |
I'm thinking about the right behavior when editing starters for a child project. If some starters are inherited from its parent, should we be able to edit them? e.g. parent<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>yanzh</groupId>
<artifactId>parent</artifactId>
<version>0.1</version>
<packaging>pom</packaging>
<name>parent</name>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.2.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<dependencies>
<!-- web stater -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project> child<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>yanzh</groupId>
<artifactId>parent</artifactId>
<version>0.1</version>
<relativePath>../</relativePath>
</parent>
<groupId>yanzh</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project> |
The fix has been released in v0.4.5. |
@Eskibear I’m still having this issue. Pull request #117 didn’t handle the case where the Currently, the workaround is to explicitly add B.T.W., it would be great if you can also add some unit tests alongside the code (I’m surprised to see barely any unit tests in this codebase), because there is another case where the relative path is an empty string ( References: |
@luangong Good catch. We can fallback to "../pom.xml" when nothing is read from i.e.
change this line to return getNode(parentNode, "relativePath", "../pom.xml"); |
@Eskibear Thanks for the quick reply. That line should do the trick. Just don’t forget to handle the case where the vscode-spring-initializr/src/handler/AddStartersHandler.ts Lines 124 to 136 in 0a510e7
Add an const relativePath = getParentRelativePath(projectNode);
if (relativePath) {
// Get Spring Boot version. Code omitted for brevity.
} else if (relativePath === '') {
// TODO: Continue search into the repository
}
return undefined; The reason is that there may the case where someone creates a Spring Boot project (packaging: pom) and publish it to the company’s internal Maven repository so that it can be used as the parent project of all other projects for the company. |
I am unable to use the 'edit starters' feature from inside the pom of the child project.
Steps:
Created a spring boot project via Spring Initializr
Opened pom -> right click -> Edit starters
Error:
Fail to edit starters. Error: Not a valid Spring Boot project.
VScode version: 1.31.0-insider
Spring Initializr version: 0.4.4
Note: I am able to do this from the parent project pom, but it does not work from the child project pom
The text was updated successfully, but these errors were encountered: