Skip to content
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

Parse Java version targeted by Maven - maven-compiler-plugin #5

Open
abdennour opened this issue Jan 20, 2022 · 1 comment
Open

Parse Java version targeted by Maven - maven-compiler-plugin #5

abdennour opened this issue Jan 20, 2022 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@abdennour
Copy link

Under build>plugins >plugin(artifactId=maven-compiler-plugin) > configuration> target

example 1 working with Java 15

	<build>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<inherited>true</inherited>
				<configuration>
					<source>15</source>
					<target>15</target>
				</configuration>
			</plugin>
    ....
  </build>

example 2 Working with Java 8 but the info is in section.

 	<properties>
		<java.version>1.8</java.version>
        </properties>
          .......
	<build>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<inherited>true</inherited>
				<configuration>
					<source>${java.version}</source>
					<target>${java.version}</target>
				</configuration>
			</plugin>
    ....
  </build>

Do you have plan to support that parsing ?

@creekorful
Copy link
Owner

Hello,

Currently, this library supports parsing plugins, but the configuration is not mapped yet:

//todo something like: Configuration map[string]string `xml:"configuration"`

So this would be the first thing to do.

Then adding a FindPlugin(string): (Plugin, bool) methods on the Project struct, will allow us to do something like the following:

project := &MavenProject{}
plugin, exists := project.FindPlugin("maven-compiler-plugin")

if exists {
     fmt.Println(plugin.Configuration["target"])
}

I can take a look to make this PR. However, I do not plan to supports <properties> parsing and extrapolation in the near future because of the amount of work needed (and because I don't need the feature). If you want it, please feel free to raise a PR :)

@creekorful creekorful added enhancement New feature or request good first issue Good for newcomers labels Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants