-
Notifications
You must be signed in to change notification settings - Fork 280
Add more java related analysis code #4437
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
50ff9f4
add more java related analysis code
saragluna 20c11e5
address comments
saragluna ab91a37
add tests
saragluna 35aefd8
fix ci
saragluna 2be10ec
fix ci
saragluna 9e155d9
address comments to add multi-module support, and add tests
saragluna adff1f8
fix ci
saragluna 1d6900d
address comments
saragluna 7b2a1eb
Merge branch 'main' into xiada/app-detect-java
saragluna File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,3 +7,5 @@ resource.syso | |
| versioninfo.json | ||
| azd.sln | ||
|
|
||
| **/target | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
cli/azd/internal/appdetect/testdata/java-multimodules/application/pom.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| <?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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <parent> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter-parent</artifactId> | ||
| <version>3.3.0</version> | ||
| <relativePath/> <!-- lookup parent from repository --> | ||
| </parent> | ||
| <groupId>com.example</groupId> | ||
| <artifactId>application</artifactId> | ||
| <version>0.0.1-SNAPSHOT</version> | ||
| <name>application</name> | ||
| <description>Demo project for Spring Boot</description> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter-actuator</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter-web</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.example</groupId> | ||
| <artifactId>library</artifactId> | ||
| <version>${project.version}</version> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter-test</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>com.mysql</groupId> | ||
| <artifactId>mysql-connector-j</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.postgresql</groupId> | ||
| <artifactId>postgresql</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| </dependencies> | ||
|
|
||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-maven-plugin</artifactId> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
|
|
||
| </project> |
27 changes: 27 additions & 0 deletions
27
...odules/application/src/main/java/com/example/multimodule/application/DemoApplication.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| package com.example.multimodule.application; | ||
|
|
||
| import com.example.multimodule.service.MyService; | ||
| import org.springframework.boot.SpringApplication; | ||
| import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
| import org.springframework.web.bind.annotation.GetMapping; | ||
| import org.springframework.web.bind.annotation.RestController; | ||
|
|
||
| @SpringBootApplication(scanBasePackages = "com.example.multimodule") | ||
| @RestController | ||
| public class DemoApplication { | ||
|
|
||
| private final MyService myService; | ||
|
|
||
| public DemoApplication(MyService myService) { | ||
| this.myService = myService; | ||
| } | ||
|
|
||
| @GetMapping("/") | ||
| public String home() { | ||
| return myService.message(); | ||
| } | ||
|
|
||
| public static void main(String[] args) { | ||
| SpringApplication.run(DemoApplication.class, args); | ||
| } | ||
| } |
1 change: 1 addition & 0 deletions
1
...ppdetect/testdata/java-multimodules/application/src/main/resources/application.properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| service.message=Hello, World |
23 changes: 23 additions & 0 deletions
23
...es/application/src/test/java/com/example/multimodule/application/DemoApplicationTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| package com.example.multimodule.application; | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| import org.springframework.beans.factory.annotation.Autowired; | ||
| import org.springframework.boot.test.context.SpringBootTest; | ||
|
|
||
| import com.example.multimodule.service.MyService; | ||
|
|
||
| @SpringBootTest | ||
| public class DemoApplicationTest { | ||
|
|
||
| @Autowired | ||
| private MyService myService; | ||
|
|
||
| @Test | ||
| public void contextLoads() { | ||
| assertThat(myService.message()).isNotNull(); | ||
| } | ||
|
|
||
| } |
29 changes: 29 additions & 0 deletions
29
cli/azd/internal/appdetect/testdata/java-multimodules/library/pom.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| <?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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <parent> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter-parent</artifactId> | ||
| <version>3.2.2</version> | ||
| <relativePath/> <!-- lookup parent from repository --> | ||
| </parent> | ||
| <groupId>com.example</groupId> | ||
| <artifactId>library</artifactId> | ||
| <version>0.0.1-SNAPSHOT</version> | ||
| <name>library</name> | ||
| <description>Demo project for Spring Boot</description> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter-test</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| </dependencies> | ||
|
|
||
| </project> |
19 changes: 19 additions & 0 deletions
19
...ta/java-multimodules/library/src/main/java/com/example/multimodule/service/MyService.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| package com.example.multimodule.service; | ||
|
|
||
| import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
| import org.springframework.stereotype.Service; | ||
|
|
||
| @Service | ||
| @EnableConfigurationProperties(ServiceProperties.class) | ||
| public class MyService { | ||
|
|
||
| private final ServiceProperties serviceProperties; | ||
|
|
||
| public MyService(ServiceProperties serviceProperties) { | ||
| this.serviceProperties = serviceProperties; | ||
| } | ||
|
|
||
| public String message() { | ||
| return this.serviceProperties.getMessage(); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.