-
Notifications
You must be signed in to change notification settings - Fork 441
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
Maven and Java "auto build" and Maven profiles #1263
Comments
@pyramid-johng you can try to add the following property:
to <your_project>/.settings/org.eclipse.m2e.core.prefs |
We are missing a setting in this extension to pass parameters to Maven for the build before the run. |
Any updates on this? It'd be nice a property to specify the active profile. |
I found that seems after updating |
Thank you very much. You solved this tedious issue for me! |
I am having the same issue, that the autobuild randomly during a maven build modifies the generated files. activeProfiles=prod does not work for us. |
This is a nice feature to have , vs code currently doesnt let to select a profile by default. I am looking for something like this https://www.jetbrains.com/help/idea/work-with-maven-profiles.html#activate_maven_profiles. I can activate a profile when I run via mvn, but am not sure how to do this via autobuild feature used by vscode. Is there any update on this? Its really painful when there are multiple profiles and you need to switch between them or different build configs. |
@deekshithanand you have to edit <your_project>/.settings/org.eclipse.m2e.core.prefs |
Why does this extension ignore the built-in |
@rantoniuk You may want to take a look at microsoft/vscode-maven#117 (comment) |
It hasn't been fixed yet. |
Note that this part of the issue, which is not purely about Maven profiles, is reported & discussed in detail here: #1381. |
With the latest |
@jdneo Is it possible to persist this in workspace settings? Or where is this persisted? |
It's persisted in the project's metadata files, which are per project. By default those files are hidden. |
Thx. I think I found a better way. <profiles>
<profile>
<id>local</id>
<activation>
<property>
<name>m2e.version</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<profiles>
<profile>local</profile>
</profiles>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles> This way I can share the config with my team without any manual steps. |
When you have a POM with multiple profiles, there seems to be no way to tell M2E what profile to build with. It will only build the profile that has "active by default" attached to it. if there is no such profile, the build output is incomplete.
Also, when running MVN build in the terminal on a different profile, the "auto build" may kick in and modify the "target" folder simultaneously with the terminal's MVN execution. This causes many hard-to-diagnose problems, like the "target" folder's contents are incorrect, or the JAR contents is incorrect. I only figured this out when i set my other profile to build to a completely separate "target-xxx" folder.
I can disable Java "auto build" and use the "standard" output folder, and a terminal-based MVN works correctly.
I tried setting the Maven plugins options (e.g. -Pdev), but apparently that does not get used when M2E runs MVN.
I don't really want all my profiles to output to different locations, and I don't want to selectively disable "auto build", so is there a way to tell M2E what profile to use, preferably on a per-folder or per-workspace basis.
Environment
Steps To Reproduce
Current Result
Expected Result
Additional Informations
Is there a way to do this currently?
The text was updated successfully, but these errors were encountered: