I created a pom file for building iOS app. It can successfully build an iOS app on Mac. I searched online and I couldn't find a way to build the same pom file on PC. I just wanted to be sure that if it's possible to build the app on PC. I read that PhoneGap apps for iOS can be built on PC. So I thought it may possible to build my app on PC. Please bear with me if it's a silly question but unfortunately I couldn't find an obvious answer for that. Here is my POM file:
<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>my.package</groupId>
<artifactId>MyAppName</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>xcode-app</packaging>
<build>
<plugins>
<plugin>
<groupId>com.sap.prd.mobile.ios.mios</groupId>
<artifactId>xcode-maven-plugin</artifactId>
<version>1.14.0</version>
<extensions>true</extensions>
<executions>
<execution>
<id>package-xcode-project</id>
<phase>package</phase>
<goals>
<goal>package-xcodeproj</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
As far as I know, X-Code is only fully available on the Mac (OS-X), there exists no complete and supported environment on the PC.
So you should not try to build an environment there, furthermore the Maven plugin is only a build tool for combining and using available tools and adds version resolution mechanics to your build process and is not responsible for the compilers themselves.
Related
Is anyone out there using OAuth to authenticate GeoServer users? I've been through installing and configuring this extension. I've tried Google and GitHub providers. I end up with a 404 error trying to access the login page. Same issue as here. There are no errors in the log with the debug level elevated as suggested.
Answering my own question here...
For me the 404 problem solved by building from source and accounting for the required dependencies using a maven plugin. Previously, I was attempting to use the prebuilt binaries and lib/ depedencies.
I built the modules from source (2.18.3) and modified the file maven file to copy the dependencies to the target folder, which I then copied to WEB-INF/lib.
Here is the pom file addition I made to get the dependencies.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/classes/lib</outputDirectory>
<includeScope>runtime</includeScope>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Thanks to a Dropwizard Maven archetype I generated a sample Dropwizard Maven project. The pom.xml notably uses maven-source-plugin:
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
When I run "clean install" I have the following error :
Plugin org.apache.maven.plugins:maven-source-plugin:2.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-source-plugin:jar:2.4: Could not transfer artifact org.apache.maven.plugins:maven-source-plugin:pom:2.4 from/to central (http://repo.maven.apache.org/maven2): Connection refused: connect -> [Help 1]
The "maven-source-plugin" dependency is stored in the Nexus repository of my company. So I tried the adding of the plugin dependency between dependencies and /dependencies :
<dependencies>
...
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
</dependency>
</dependencies>
but it did not correct the problem. I also tried to add the dependency at the call of the plugin :
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
</dependency>
</dependencies>
</plugin>
but it did not work either
Two possible situations :
Your company uses a proxy to connect to the public Maven repository. Then ask someone in your company what the IP address of the proxy is then put it in your settings.xml file
Your company has its/their own Maven repository/ies (Nexus repository for example). Then ask someone in your company what the Nexus repository is then put it in your pom.xml or in your settings.xml. See Adding maven nexus repo to my pom.xml and https://maven.apache.org/guides/mini/guide-multiple-repositories.html
It may happen, e.g. after an interrupted download, that Maven cached a broken version of the referenced package in your local repository.
Solution: Manually delete the folder of this plugin from cache (i.e. your local repository), and repeat maven install.
How to find the right folder? Folders in Maven repository follow the structure:
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
</dependency>
is cached in ${USER_HOME}\.m2\repository\org\apache\maven\plugins\maven-source-plugin\2.4
Update the apache-maven-3.5.0-bin\apache-maven-3.5.0\conf\settings.xml file.
Check your internet explorer proxy --> Setting --> Internet explorer -->Connection --> LAN Setting
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>user</username>
<password>****</password>
<host>proxy</host>
<port>8080</port>
</proxy>
I am using JDK 7 for maven project and I used -Dhttps.protocols=TLSv1.2 as argument in JRE. It has allowed to download all maven repository which were failing earlier.
org.apache.maven.plugins:maven-source-plugin does not exist in the repository http://repo.maven.apache.org/maven2.
You have to download it from Maven central where it exists => maven-source-plugin
Verify your pom definition or your settings.xml file.
so I am assuming that this project you are doing in your private eclipse (not company provided eclipse where you work). The same problem I resolved just as below
quick fix : got to .m2 file --> create a backup of settings.xml --> remove settings.xml --> restart your eclipse.
On my side it was coming from an error in my settings.xml file.
I had a bad tag. Just removed it, refreshed and i was good to go.
Remove the content of the folder \.m2\repository\org\apache\maven\plugins\maven-resource-plugin\2.7. The cached info turned out to be the issue.
I use intelliJ and finally I created my own settings.xml and added the following content structure to it. In my project's pom.xml, the nexus repositories were defined but for some reason it was always hitting the external apache maven repo which is blocked in my company.
<settings>
<mirrors>
<id>nexus</id>
<url>nexusURL </url>
<mirrorOf>central</mirrorOf>
<mirror>
<profiles>
<profile>
<repositories>
<repository>
</settings>
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project.
Failed to deploy artifacts: Could not transfer artifactReturn code is: 401, ReasonPhrase: Unauthorized. -> [Help 1]
There was no changes made since last successful build.
I double check settings.xml(username and password).Also check in pom.xml(distribution management)
I working on this issue since last 2 days.I gone through all the forum,nothing works.please help me out.
This error message means your machine is not authenticating correctly to the Nexus machine. The credentials sent to Nexus from Maven are not correct.
When I have gotten this message, I usually have to look in my settings.xml to verify the proper credentials in this part. The username and password have to be the right ones as set in Nexus itself.
<servers>
<server>
<id>nexus-releases</id>
<username>fillin</username>
<password>fillin</password>
</server>
</servers>
I usually go the Nexus GUI and try to log in with those credentials to verify them but it is possible to configure credentials that can publish via mvn but not log into the GUI.
One possible problem is if you are using dependency-management to identify where to deploy in case of "mvn deploy" target. There is a section like this:
<distributionManagement>
<repository>
<id>nexus-releases</id>
<name>releases</name>
<url>http://myNexus/more/stuff</url>
</repository>
</distributionManagement>
and the id field has to match the the id on the credentials in the settings.xml. If the ids don't match, you will get this error.
Another possible problem is that if you are using an execution for the maven-deply-plugin in your pom.xml, you might have the configuration property
<repositoryId>nexus-releases</repositoryId>
and again it doesn't match the id in the settings.xml so it fails with your error.
Similarly, if deploying using the command line option on the "mvn" command that looks like this
-DrepositoryId=nexus-releases
doesn't match the id in the settings.xml, again, it won't work.
Following our discussion in the comments section,
try to run this pom.xml
When the mvn goal should be : mvn deploy
The only two things you need is having a pom and passing the arguments:
This is the pom.xml you can use:
<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.hp.Maven</groupId>
<artifactId>Maven-Nexus</artifactId>
<packaging>pom</packaging>
<version>1.0.0</version>
<properties>
<baseNexusURL>${baseNexusURL}</baseNexusURL>
<targetRepositoryID>${repositoryId}</targetRepositoryID>
<package.final.name>${project.artifactId}</package.final.name>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<executions>
<execution>
<id>default-deploy</id>
<configuration>
<skip>true</skip>
</configuration>
</execution>
<execution>
<id>deploy-node-modules-artifact</id>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<file>${file}</file>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
<packaging>${packaging}</packaging>
<generatePom>true</generatePom>
<repositoryId>${targetRepositoryID}</repositoryId>
<url>${baseNexusURL}/content/repositories/${targetRepositoryID}</url>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I need to build and deploy the war into glassfish using maven(Problem explained below).
Currently I managed to deploy the war using maven glassfish plugin and I've used the goal redploy as shown in the POM below:
<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>Myapp</groupId>
<artifactId>Myapp</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<name>APP WEB APP</name>
<url>http://maven.apache.org</url>
<build>
<finalName>MyApp</finalName>
<plugins>
<plugin>
<groupId>org.glassfish.maven.plugin</groupId>
<artifactId>maven-glassfish-plugin</artifactId>
<configuration>
<terse>false</terse>
<echo>true</echo>
<debug>true</debug>
<glassfishDirectory>C:\glassfish3\glassfish</glassfishDirectory>
<user>admin</user>
<adminPassword>admin</adminPassword>
<domain>
<name>domain1</name>
<host>localhost</host>
<adminPort>4848</adminPort>
</domain>
<components>
<component>
<name>${project.artifactId}</name>
<artifact>${project.build.directory}/${project.build.finalName}.war</artifact>
</component>
</components>
</configuration>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>redeploy</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Problem: say there is already a war deployed and when I execute the command mvn clean install and something goes wrong during the deployment.Since I've used the goal as redeploy the war would 1st do a undeploy and then do a deploy.In my case this POM cannot be used for the next time because there is a failure and the war does not exist.
Help required
Please help me to achieve a check in POM whether the war is deployed or not and then based on the result I need to initiate goals deploy or undeploy which suites.
Say there is no war deployed i need to call glassfish:deploy in POM.
Thanks for your time in advance
Found my answer Here:
Redeploy remote glassfish with cargo fails
No matter there is or isn't a war deployed the cargo plugin takes care of the above mentioned problem.
Main Catch is adding
<cargo.runtime.args>force=true</cargo.runtime.args>
Could anayone give me some sugestions on how to create a pom.xml file for a multimodules project, that is build with ant? I need to create this pom.xml file in order to analyze the project with Sonar.
I suggest to follow the instructions from the Sonar documentation. See Analyzing Java Projects:
Project with multiple sources directories
If your non-maven project contains
more than one sources directory, you
can specify which sources directories
to analyse by adding a new section
about the Build Helper Maven Plugin
into your pom.xml file :
<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>[YOUR.ORGANIZATION]</groupId>
<artifactId>[YOUR.PROJECT]</artifactId>
<name>[YOUR PROJECT NAME]</name>
<version>[YOUR PROJECT VERSION]</version>
<build>
<sourceDirectory>[YOUR SOURCE DIRECTORY]</sourceDirectory>
<outputDirectory>[YOUR CLASSES/BIN DIRECTORY</outputDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<excludes>
<exclude>**/*.*</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>[YOUR SOURCE DIRECTORY 2]</source>
<source>[YOUR SOURCE DIRECTORY 3]</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<sonar.dynamicAnalysis>false</sonar.dynamicAnalysis>
<sonar.phase>generate-sources</sonar.phase>
</properties>
</project>
Replace the parameters :
...
And execute the maven2 plugin as explained in the installation guide :
mvn sonar:sonar
There is now a Sonar Ant Task that you can use, or there is also the Sonar Runner
What you put in the pom.xml is going to depend what dependencies you need to use and what plugins you need to run. Check out the Intro to POM to see what it is made up of.
I think you can try to use the builder-helper-maven-plugin, currently, latest version is 1.5.
as documented http://docs.codehaus.org/display/SONAR/Analyzing+Java+Projects. However, just change the plugin version to 1.5 and use mvn sonar3:sonar. Most importantly, dont forget <sonar.phase>generate-sources</sonar.phase>, without this, it doesn't work.
as for the output directory, if using eclipse, you can specify the output directory for each module, and make them point to the same folder. Use this folder as the outputdirectory for pom.xml. remember to disable scrub, if using eclipse.