Upgrading GWT from 1.7 to 2.4 using Maven - gwt

In my project we are using GWT 1.7 and now we want to upgrade it to 2.4. We also using maven 1.6 to build project. I've changed all pom.xml files so they look like this:
<properties>
<gwt.version>2.4.0</gwt.version>
</properties>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<scope>runtime</scope>
</dependency>
</dependencies>
Now, when i'm trying to build project, it crushes with error:
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] artifact not found - Unable to download the artifact from any repository
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=com.google.gwt -DartifactId=gwt-dev -Dversion=2.4.0 -Dclassifier=linux-libs -Dpackaging=zip -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=com.google.gwt -DartifactId=gwt-dev -Dversion=2.4.0 -Dclassifier=linux-libs -Dpackaging=zip -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
com.google.gwt:gwt-dev:zip:2.4.0
from the specified remote repositories:
central (http://repo1.maven.org/maven2),
smartgwt-maven (http://www.smartclient.com/maven2),
repo.pentaho.org (http://repository.pentaho.org/artifactory/pentaho),
java-net-maven2 (http://download.java.net/maven/2),
thirdparty.pentaho.org (http://repository.pentaho.org/artifactory/thirdparty),
Octo Technology Nexus (http://forge.octo.com/nexus/content/groups/public),
codehaus-maven-repo (http://repository.codehaus.org/org/codehaus/mojo/)
I've downloaded files gwt-2.4.0.zip and gwt-servlet-2.4.0.jar, and tried to mvn install both of them, and now i have in my .m2/repository/com/google/gwt/ 4 directories: gwt, gwt-dev, gwt-servlet and gwt-user, all of them have 2.4.0 category inside (some also have old 1.7.0) directory, but the build error still appears.
UPDATE
Now i've change version to <gwt.version>2.5.0-rc1</gwt.version> , started maven build, i saw when mvn was downloading the required package, but it appears again:
com.google.gwt:gwt-dev:jar:2.5.0-rc1
not found. I've downloaded the gwt-2.5.0.zip from google website, and there are a lot of .jar files inside, which one should i install?

Related

Maven jar dependency not found at runtime by OSGi environment

I'm building an Eclipse product that requires some external dependencies, which are not bundled as Eclipse plugins.
For example javax.json-1.1.4.jar.
I'm usign a target platform file, with Maven dependency added. This is the relevant part of the .target file:
<location includeDependencyScope="compile" includeSource="true" missingManifest="generate" type="Maven">
<dependencies>
......
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<version>1.1.4</version>
<type>jar</type>
</dependency>
</dependencies>
</location>
The resulting bundle is included from the plugin that uses this Json implementation: this is the MANIFEST of the plugin
Require-Bundle: org.glassfish.javax.json;bundle-version="1.1.4"
The plugin compiles and run normally. The problem happens at runtime, when the Json implementation is loaded:
2022-03-11 09:44:18,166 ERROR [main]: Provider org.glassfish.json.JsonProviderImpl not found
2022-03-11 09:44:18,168 ERROR [main]:
javax.json.JsonException: Provider org.glassfish.json.JsonProviderImpl not found
at javax.json.spi.JsonProvider.provider(JsonProvider.java:99)
at javax.json.Json.createReader(Json.java:225)
at com.test.mas.rcp.hwconfigurator.sirius.core.utils.MotorDataHandler.parseMotorJsonFile(MotorDataHandler.java:64)
at com.test.mas.rcp.hwconfigurator.sirius.core.utils.DBHandler.initMotorsDB(DBHandler.java:209)
at com.test.mas.rcp.hwconfigurator.sirius.core.utils.DBHandler.getMotors(DBHandler.java:116)
at com.test.mas.rcp.hwconfigurator.sirius.core.impl.FieldBusDevice.getMotors(FieldBusDevice.java:1323)
at com.test.mas.rcp.hwconfigurator.sirius.core.impl.FieldBusDevice.createFromSiriusString(FieldBusDevice.java:1257)
at com.test.mas.rcp.hwconfigurator.sirius.core.impl.HwConfiguratorFactoryImpl.createFieldBusDeviceFromString(HwConfiguratorFactoryImpl.java:252)
at com.test.mas.rcp.hwconfigurator.sirius.core.impl.HwConfiguratorFactoryImpl.createFromString(HwConfiguratorFactoryImpl.java:93)
at org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.createFromString(XMLHelperImpl.java:1615)
at org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.setValue(XMLHelperImpl.java:1156)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setFeatureValue(XMLHandler.java:2710)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setAttribValue(XMLHandler.java:2769)
at org.eclipse.emf.ecore.xmi.impl.SAXXMIHandler.handleObjectAttribs(SAXXMIHandler.java:79)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromFactory(XMLHandler.java:2247)
Caused by: java.lang.ClassNotFoundException: org.glassfish.json.JsonProviderImpl cannot be found by javax.json-api_1.1.4
at org.eclipse.osgi.internal.loader.BundleLoader.generateException(BundleLoader.java:516)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass0(BundleLoader.java:511)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:403)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:168)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at javax.json.spi.JsonProvider.provider(JsonProvider.java:96)
at javax.json.Json.createReader(Json.java:225)
at com.test.mas.rcp.hwconfigurator.sirius.core.utils.MotorDataHandler.parseMotorJsonFile(MotorDataHandler.java:64)
at com.test.mas.rcp.hwconfigurator.sirius.core.utils.DBHandler.initMotorsDB(DBHandler.java:209)
at com.test.mas.rcp.hwconfigurator.sirius.core.utils.DBHandler.getMotors(DBHandler.java:116)
at com.test.mas.rcp.hwconfigurator.sirius.core.impl.FieldBusDevice.getMotors(FieldBusDevice.java:1323)
at com.test.mas.rcp.hwconfigurator.sirius.core.impl.FieldBusDevice.createFromSiriusString(FieldBusDevice.java:1257)
at com.test.mas.rcp.hwconfigurator.sirius.core.impl.HwConfiguratorFactoryImpl.createFieldBusDeviceFromString(HwConfiguratorFactoryImpl.java:252)
The javax.json-1.1.4.jar is not found at runtime by the api jar javax.json-api_1.1.4.
The only way I found to make it work is to add the implementation jar to the runtime classpath settings of the plugin, in the Bundle-Classpath:
Bundle-ClassPath: .,
lib/javax.json-1.1.4.jar,
This requires the jar in the lib folder of the plugin, while it is already included from the tartget platform. It should be enough..
Is there a configuration or something to be done to make the OSGi environment recognise the jar as a Maven dependency at runtime?
I have read about Eclipse-BuddyPolicy and DynamicImport-Package but I don't know how to used them in my case, and if they are usefull.
This https://github.com/eclipse-ee4j/jsonp/issues/96 says that it "Should be fixed with javax.json:1.1.4 and jakarta.json:1.1.5" but I don't
get how...
I managed to fix this problem, thanks to the comments in this thread:
https://github.com/eclipse-ee4j/jax-ws-api/issues/90
in particular the last one:
https://github.com/eclipse-ee4j/jax-ws-api/issues/90#issuecomment-952793454
This is related to a veri similar problem I had with the implementation of the
com.sun.xml.ws.spi.ProviderImpl web service provider.
Including the OSGi Resource Locator in the bundle manifest, and the plugin with the actual implementations, make them discoverable at runtime.
This is the dependency in the target platform file:
<dependency>
<groupId>org.glassfish.hk2</groupId>
<artifactId>osgi-resource-locator</artifactId>
<version>2.5.0-b42</version>
<type>jar</type>
</dependency>
In the end, for the Json problem, I switched to the Eclipse Parsson implementation which works at runtime without problems.
These are the needed dependencies in the target platform:
<dependency>
<groupId>org.eclipse.parsson</groupId>
<artifactId>jakarta.json</artifactId>
<version>1.0.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.eclipse.parsson</groupId>
<artifactId>parsson</artifactId>
<version>1.0.0</version>
<type>jar</type>
</dependency>

Remove Unnecesary Maven Dependencies from Eclipse

I am working with Spring-Boot 2.3.8 and Eclipse.
I am using these dependencies to work on some videos:
<!-- javacv -->
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacv</artifactId>
<version>1.5.4</version>
</dependency>
<!--opencv-platform -->
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>opencv-platform</artifactId>
<version>4.4.0-1.5.4</version>
</dependency>
<!-- ffmpeg-platform -->
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>ffmpeg-platform</artifactId>
<version>4.3.1-1.5.4</version>
</dependency>
Eclipse is adding all JARs of opencv, javaccp and ffmpeg, including JARs for Androind, MacOs, etc. I just need the ones for Windows and the problem is that these extra dependencies are creating problems for my teams when they try to load the project, build or test it (it is extreamly slow or just doesnt work).
These dependencies are not present in my final WAR when I build with maven form the command line and I use:
mvn -Djavacpp.platform=windows-x86_64 clean install
Is there a way to tell eclipse to do the same?
The WAR size goes from 800 MB to around 200 MB when building without and with and the platform flag, these extra 600 MB are what in my opinion is too much for eclipse.
Here is an image of all the JARs being added to the project.

selenium webdriver later than 2.29.1 not working in maven

Does anyone knows why later version of selenium not working in maven project in eclipse? I have the below code in pom.xml of my maven project and it works fine
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.29.1</version>
</dependency>
</dependencies>
but if I change the version e.g. 2.29.1 to 2.53 or 3.something , my project doesn't run and gives the ff.error
Try this :
Right click on the project, go to Maven > Enable Work Space Resolution.
this should start downloading the dependencies and build the project.

eclipse maven external jars unable to compile

Maven compilation failes even after adding the external jars to eclipse. My Eclipse codes are okay with external jars, however when I compile Maven complains package blah blah not found, and I have almost 50 external packages.
I will use the mvn dependency to add the jars later.
However It should work, but not luck.
Any troubleshooting/suggestion please.
I think you can not get away with Maven Project without having <dependencies> tag in your pom.xml (Whether you run it from eclipse or from command-line) . That too for the project which is dependent on classes that are coming from 50 external jars.
If you don't want maven to look for these jars, you have to add below entry in pom.xml with system scope:
<dependencies>
<dependency>
<groupId>selenium-server-standalone</groupId>
<artifactId>selenium-server-standalone</artifactId>
<version>2.46.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/selenium-server-standalone-2.46.0.jar</systemPath>
</dependency>
</dependencies>
With this, groupID & artifactID are meaningless. You can write such 50 <dependency> tags for referring your 50 external jars.

eclipse cannot find the jar available in maven dependencies

I have a pom.xml with the following entry
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.1.0.RELEASE</version>
</dependency>
And on maven install the jar is added to the maven repository and is also listed in the maven dependencies library.
But I am not able to import any of the classes from the added jar 'spring-web-3.1.0.RELEASE.jar' for the particular entry, though it shows in the classpath
The error - in eclipse "cannot be resolved to a type"
environment - maven 3.1 and Spring tool suite
Thanks
Solved - found the solution through some other forum
The jar inside the repository was corrupted.
After clearing the .m2 folder in the physical drive and repeating the maven clean install worked.
Thanks for the time #techidiot #jtravaglini.