What is the simplest pluginManagement section on can add to a pom to get m2e and eclipse indigo to play together? - m2e

I have read the discussions on this topic but I don't see a simple solution.
Given the following really simple pom.xml, Indigo Eclipse and m2e (version 0.14.0.201107060316), eclipse complains with
Multiple annotations found at this line
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-resources-plugin:2.4.3:resources (execution: default-resources, phase: process-resources)
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-resources-plugin:2.4.3:testResources (execution: default-testResources, phase: process-test-resources)
on
<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>com.mycompany.myproject</groupId>
<artifactId>myartifact</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>myartifact</name>
<url>http://maven.apache.org</url>
</project>
I know it has something to do with adding a section as shown in http://wiki.eclipse.org/M2E_plugin_execution_not_covered#execute_plugin_goal
I thought adding the following section to the pom.xml would clear at least one error, but it didn't so I must not have a clear understanding of what is wrong.
Any advice? I'm sure this is simple for some of you.
<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>com.mycompany.myproject</groupId>
<artifactId>myartifact</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>myartifact</name>
<url>http://maven.apache.org</url>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<versionRange>2.4.3</versionRange>
<goals>
<goal>resources:resources</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute >
<runOnIncremental>false</runOnIncremental>
</execute >
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</project>

I face the same problem (Eclipse Indigo, Maven 3.0.2). I solved it following the steps indicated here:
http://code.google.com/p/google-web-toolkit/wiki/WorkingWithMaven
I installed the following features (use eclipse->Help->Install New Software):
- Maven Integration for Eclipse
- Maven Integration for WTP
from here:
http://download.jboss.org/jbosstools/updates/m2eclipse-wtp
Once I installed these features I update the project (rightclik on the project->Maven->Update project..). This worked for me. I hope this can help.

Related

cannot add sqlite dependancy to pom

<?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>
<groupId>groupId</groupId>
<artifactId>mvDB</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>16</maven.compiler.source>
<maven.compiler.target>16</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.34.0</version>
</dependency>
</dependencies>
</project>
i'm using the latest version of intelliJ
it lists all 3 lines relating to the dependancy as having problems.
Dependency 'org.xerial:sqlite-jdbc:3.34.0' not found
Dependency 'org.xerial:sqlite-jdbc:3.34.0' not found
Dependency 'org.xerial:sqlite-jdbc:3.34.0' not found
thanks!
I'm a big fan of JetBrains tool.
Make sure you click on the Load Maven Changes button (Ctrl+Shift+O) after changing pom.xml
image of button

Could not find artifact javafx-packager:javafx-packager:

This is my pom.xml
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ginkgo</groupId>
<artifactId>csgo-cfg-helper-client</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>16</maven.compiler.release>
<javafx.version>16</javafx.version>
<javafx.maven.plugin.version>0.0.6</javafx.maven.plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>${javafx.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>${maven.compiler.release}</release>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>${javafx.maven.plugin.version}</version>
<configuration>
<jlinkImageName>csgo_cfg_helper</jlinkImageName>
<launcher>launcher</launcher>
<mainClass>com.ginkgo.csgo.Main</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>com.zenjava</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>8.8.3</version>
<configuration>
<mainClass>com.ginkgo.csgo.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>
My Operating System: MacOs Big Sur 11.4
JDK: openjdk-16.0.1
I want to make a .dmg or .pkg file using command mvn clean jfx:native, however, it doesn't work.
[ERROR] Failed to execute goal com.zenjava:javafx-maven-plugin:8.8.3:jar (jar) on project csgo-cfg-helper-client: Execution jar of goal com.zenjava:javafx-maven-plugin:8.8.3:jar failed: Plugin com.zenjava:javafx-maven-plugin:8.8.3 or one of its dependencies could not be resolved: Could not find artifact javafx-packager:javafx-packager:jar:1.8.0_20 at specified path /Users/hll/Library/Java/JavaVirtualMachines/openjdk-16.0.1/Contents/Home/../lib/ant-javafx.jar -> [Help 1]
Is it Java Version too high? jLink work well and generate module success.
How should i do? This is my first time to bulid a JavaFX project. I find the same question in stackoverflow, but no useful answer.Thanks for your help.
You seem to follow an ancient tutorial. Just start with the official docs and not some crap pulled from the internet. https://openjfx.io/openjfx-docs/ And for packaging you app have a look here: https://docs.oracle.com/en/java/javase/16/jpackage

I can't debug an application using netbeans 11 with JavaFX 12

I've downloaded netbeans 11 with support for java 12
So I followed up the steps from the Gluon webpage running JavaFX and Netbeans Non modular with maven > https://openjfx.io/openjfx-docs/#next-steps
I have configured as showed in the instructions the action to run this app.
Run Project
clean javafx:run
But there is nothing specified to debug the project.
Is there a way to debug this javaFX project?
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>SimonSaysGFX</artifactId>
<version>1.0.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>12</maven.compiler.source>
<maven.compiler.target>12</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>12.0.1</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-media</artifactId>
<version>12.0.1</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>12.0.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>12</release>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.2</version>
<configuration>
<mainClass>com.mycompany.simonsaysgfx.App</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<name>SimonSaysGFX</name>
</project>
If you see the documentation of the javafx-maven-plugin, you can add some VM arguments to the run goal in order to debug your project in NetBeans.
However, to keep the usual run goal ready to just run the project and not debug, without commenting out the added options, we can add a second execution to the plugin.
Modify your plugin like this:
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.2</version>
<executions>
<execution>
<!-- Default configuration for running -->
<id>default-cli</id>
<configuration>
<mainClass>com.mycompany.simonsaysgfx.App</mainClass>
</configuration>
</execution>
<execution>
<!-- Configuration for debugging -->
<id>debug</id>
<configuration>
<options>
<option>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:8000</option>
</options>
<mainClass>com.mycompany.simonsaysgfx.App</mainClass>
</configuration>
</execution>
</executions>
</plugin>
Now you can run from command line:
mvn clean javafx:run
to run as usual your application, and:
mvn clean javafx:run#debug
to start debug mode. Then you will see something like:
[INFO] --- javafx-maven-plugin:0.0.2:run (debug) # Project ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to /path/to/project/target/classes
Listening for transport dt_socket at address: 8000
At this point, you need to set your breakpoints and attach a debugger from NetBeans -> Debug -> Attach Debugger to port 8000:
Click OK and you will be able to debug your projects.
Note that you can also define custom NetBeans actions to use the Run and Debug buttons. Add a nbactions.xml file to the root of your project, with this two actions:
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>run</actionName>
<goals>
<goal>clean</goal>
<goal>javafx:run</goal>
</goals>
</action>
<action>
<actionName>jlink</actionName>
<goals>
<goal>clean</goal>
<goal>javafx:jlink</goal>
</goals>
</action>
<action>
<actionName>debug</actionName>
<goals>
<goal>clean</goal>
<goal>javafx:run#debug</goal>
</goals>
</action>
</actions>
Now you can use NetBeans run and debug buttons.
José's answer is good. Just go little bit further.
In pom.xml set the
address=${jpda.address} instead of address=*:8000
<execution>
<!-- Configuration for debugging -->
<id>debug</id>
<configuration>
<options>
<option>-agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address}</option>
</options>
<mainClass>cz.masci.mvcpattern.mvc.App</mainClass>
</configuration>
</execution>
Be aware of set server=n, otherwise the application will not start.
In the debug action set jpda.listen=true property
...
<action>
<actionName>debug</actionName>
<goals>
<goal>clean</goal>
<goal>javafx:run#debug</goal>
</goals>
<properties>
<jpda.listen>true</jpda.listen>
</properties>
</action>
Then you don't need to attach debuger anymore. Netbeans does it for you.

Compiling multiple .as files using Maven

I am having issues getting maven to do a simple clean install I am getting the following error:
Failed to execute goal org.sonatype.flexmojos:flexmojos-maven-plugin:3.8:compile-swf (default-compile-swf) on project flex: Source file not expecified and no default found! -> [Help 1]
I was following the tutorial on this site: Adobe Developer Connection - Flex and Maven
I have all of my .as files located in: src/main/flex/ but the problem is that I don't have a Main class, these are all basically interfaces so I can't just choose one of them to be the source file.
I have Eclipse installed as well, and it is yelling at me for the plugin part of the POM, saying:
Multiple annotations found at this line:
- Plugin execution not covered by lifecycle configuration: org.sonatype.flexmojos:flexmojos-maven-plugin:
3.8:compile-swf (execution: default-compile-swf, phase: compile)
- Plugin execution not covered by lifecycle configuration: org.sonatype.flexmojos:flexmojos-maven-plugin:
3.8:test-compile (execution: default-test-compile, phase: test-compile)
So I am not sure if this is related or not, but I have tried to copy/paste the code from the link above verbatim but I still get that error and the guy never mentions anything about it, so perhaps it's just a bug in the maven plugin in Eclipse.
Here is my POM.xml file:
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.company</groupId>
<artifactId>parent</artifactId>
<version>1.0</version>
</parent>
<artifactId>flex</artifactId>
<name>flex</name>
<packaging>swf</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.company</groupId>
<artifactId>common</artifactId>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>flex-framework</artifactId>
<version>3.6.0.16995</version>
<type>pom</type>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/flex</sourceDirectory>
<plugins>
<plugin>
<groupId>org.sonatype.flexmojos</groupId>
<artifactId>flexmojos-maven-plugin</artifactId>
<extensions>true</extensions>
<dependencies>
<dependency>
<groupId>com.adobe.flex</groupId>
<artifactId>compiler</artifactId>
<version>3.6.0.16995</version>
<type>pom</type>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
I am open to ANY ideas on how to get this to compile these .as files. Thank you!
Edit: Okay I figured it out. I changed the packaging from swf to swc and it works. So very sad.
I converted the package from swf to swc and it worked like a champ. Hopefully this helps someone in the future.
you need the configuration tag so flexmojos knows where to start the build. (default application, or main class)
<plugin>
<groupId>org.sonatype.flexmojos</groupId>
<artifactId>flexmojos-maven-plugin</artifactId>
<extensions>true</extensions>
<dependencies>
<dependency>
<groupId>com.adobe.flex</groupId>
<artifactId>compiler</artifactId>
<configuration>
<sourceFile>Module.mxml</sourceFile>
</configuration>
<version>3.6.0.16995</version>
<type>pom</type>
</dependency>
</dependencies>
</plugin>

Flyway not finding my sql migrations in db/migration

The error:
[ERROR] com.googlecode.flyway.core.api.FlywayException: Unable to determine URL for classpath location: db/migration (ClassLoader: ClassRealm[plugin>com.googlecode.flyway:flyway-maven-plugin:2.1.1, parent: sun.misc.Launcher$AppClassLoader#43be2d65])
I followed the quickstart, so I'm not really doing anything complex yet.
pom.xml
<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>com.cpt.migrations</groupId>
<artifactId>cpt_migrations</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>cpt_migrations</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.24</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.googlecode.flyway</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<user>root</user>
<password></password>
<driver>com.mysql.jdbc.Driver</driver>
<url>jdbc:mysql://localhost:3306/cpt</url>
</configuration>
</plugin>
</plugins>
</build>
</project>
And my folder structure is the prescribed PROJECT_ROOT/src/main/resources/db/migration/V1__Base_version.sql:
I get the error when, from the PROJECT_ROOT, I execute:
mvn flyway:migrate
Don't forget to call compile first, to make sure the resources are copied over.
In my case I had to explicitely set
flyway.locations=classpath:db/migration
in my application.properties (Spring Boot) for it to work.
in my case this error was caused as package with name db.migration was created
instead of db -> migration
It has to be compiled:
mvn compile flyway:migrate
You may use
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>migrate</goal>
</goals>
</execution>
<execution>
<id>clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
in
<plugin>..</plugin>
and then just mvn compile is needed for execution of migrate task
In my case IntelliJ Idea created a folder db.migration instead of two separate folders db and migration inside
Execute mvn command from directory where target dir is located.

Resources